[cfe-commits] r91909 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
Douglas Gregor
dgregor at apple.com
Tue Dec 22 09:47:18 PST 2009
Author: dgregor
Date: Tue Dec 22 11:47:17 2009
New Revision: 91909
URL: http://llvm.org/viewvc/llvm-project?rev=91909&view=rev
Log:
Enter the scope of an initializer for direct-initialization as well as
for copy-initialization.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=91909&r1=91908&r2=91909&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Dec 22 11:47:17 2009
@@ -574,14 +574,30 @@
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);
Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp?rev=91909&r1=91908&r2=91909&view=diff
==============================================================================
--- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp Tue Dec 22 11:47:17 2009
@@ -10,7 +10,9 @@
struct S {};
S i;
extern S j;
+ extern S j2;
}
int i = 2;
N::S N::j = i;
+N::S N::j(i);
More information about the cfe-commits
mailing list