Open ranaanoop opened 1 month ago
As pointed out in the linked Stack Overflow thread, this is just CWG2688.
And furthermore I think we can resolve it in a way that doesn't make this int
invalid. We can strike [class.mfct.non.static]/1 which seems to me to be old explanatory text rather than something with a well-defined normative meaning.
Full name of submitter: Anoop Rana
Issue description:
The below program
(&w::f)(2)
seems to be ill-formed as per the current wording due to omission because there is no class object on which the non-static member function is called. We see implementation divergence here. Both gcc and msvc rejects(&w::f)(0)
while clang accepts it.class.mfct.non.static seems to make this ill-formed because there isn't any class-type object on which the member function
f
would be called.Suggested resolution:
This can be fixed by making a restriction that the explicit object parameter can only has the same class type(with possible cv qualifier etc). That is,
this int
should not be possible. Or other option is by removing/changing [class.mfct.non.static#1].