Skip to content
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

Closed
llvmbot opened this issue Feb 12, 2013 · 8 comments
Closed

clang makes nested-namespace incorrectly #15615

llvmbot opened this issue Feb 12, 2013 · 8 comments
Labels
bugzilla Issues migrated from bugzilla c++ duplicate Resolved as duplicate

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 12, 2013

Bugzilla Link 15243
Resolution DUPLICATE
Resolved on Apr 16, 2015 18:15
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

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();
}

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Feb 12, 2013

Clang is correct. The inner ::CFoo is the injected class name.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 13, 2013

Could you explain about this behavior? GCC handles it as an error.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Feb 20, 2013

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.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Apr 29, 2013

*** Bug llvm/llvm-bugzilla-archive#15860 has been marked as a duplicate of this bug. ***

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Mar 28, 2014

*** Bug llvm/llvm-bugzilla-archive#19276 has been marked as a duplicate of this bug. ***

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Apr 17, 2015

*** This bug has been marked as a duplicate of bug #13775 ***

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#15860

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#19276

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 4, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++ duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

1 participant