-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang makes nested-namespace incorrectly #15615
Comments
Clang is correct. The inner ::CFoo is the injected class name. |
Could you explain about this behavior? GCC handles it as an error. |
Looks like GCC implements the resolution of core issue 1310, under which this is ill-formed. For some lookups, this rule applies: C++ [class]p2: "A class-name is inserted into the scope in which it is declared immediately after the class-name is seen. The class-name is also inserted into the scope of the class itself; this is known as the injected-class-name." However, under core issue 1310, this only applies in the rarer case of a lookup which ignores function names. So the 'CFoo::CFoo::' finds the injected-class-name, but the final '::CFoo' is a constructor name. |
*** Bug llvm/llvm-bugzilla-archive#15860 has been marked as a duplicate of this bug. *** |
*** Bug llvm/llvm-bugzilla-archive#19276 has been marked as a duplicate of this bug. *** |
*** This bug has been marked as a duplicate of bug #13775 *** |
mentioned in issue llvm/llvm-bugzilla-archive#15860 |
mentioned in issue llvm/llvm-bugzilla-archive#19276 |
Extended Description
Following code snippet seems incorrect, but clang handles it without error.
class CFoo
{
public:
CFoo() {};
~CFoo() {};
};
int main()
{
CFoo::CFoo::CFoo::CFoo::CFoo* pFoo = new CFoo();
}
The text was updated successfully, but these errors were encountered: