diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 17:47:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 17:47:17 +0000 |
commit | b4debaebedfeb3161cd7bce0d13f005ab442fa5e (patch) | |
tree | 839993231dc922af5c573a6e3661f9a29526ce17 | |
parent | 5b5ad8453c8e79f642c3ddfeeadf162ae67309c0 (diff) |
Enter the scope of an initializer for direct-initialization as well as
for copy-initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91909 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 16 | ||||
-rw-r--r-- | test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 43c92456d2..347d67a19a 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -574,14 +574,30 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D, ExprVector Exprs(Actions); CommaLocsTy CommaLocs; + if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + EnterScope(0); + Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl); + } + if (ParseExpressionList(Exprs, CommaLocs)) { SkipUntil(tok::r_paren); + + if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl); + ExitScope(); + } } else { // Match the ')'. SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() && "Unexpected number of commas!"); + + if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl); + ExitScope(); + } + Actions.AddCXXDirectInitializerToDecl(ThisDecl, LParenLoc, move_arg(Exprs), CommaLocs.data(), RParenLoc); diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp index 846d385e1e..2ed87b4e68 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -10,7 +10,9 @@ namespace N { struct S {}; S i; extern S j; + extern S j2; } int i = 2; N::S N::j = i; +N::S N::j(i); |