[cfe-commits] r74833 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaCXX/constructor.cpp

Douglas Gregor dgregor at apple.com
Mon Jul 6 09:40:49 PDT 2009


Author: dgregor
Date: Mon Jul  6 11:40:48 2009
New Revision: 74833

URL: http://llvm.org/viewvc/llvm-project?rev=74833&view=rev
Log:
Parsing fix for out-of-line constructors, from Piotr Rak

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/SemaCXX/constructor.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=74833&r1=74832&r2=74833&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Jul  6 11:40:48 2009
@@ -2125,8 +2125,9 @@
         // constructor name. 
         if (!D.getDeclSpec().hasTypeSpecifier() &&
             Actions.isCurrentClassName(*Tok.getIdentifierInfo(),CurScope)) {
+          CXXScopeSpec *SS = afterCXXScope? &D.getCXXScopeSpec() : 0;
           D.setConstructor(Actions.getTypeName(*Tok.getIdentifierInfo(),
-                                               Tok.getLocation(), CurScope),
+                                               Tok.getLocation(), CurScope, SS),
                            Tok.getLocation());
         // This is a normal identifier.
         } else
@@ -2171,7 +2172,8 @@
           // FIXME: Inaccurate.
           SourceLocation NameLoc = Tok.getLocation();
           SourceLocation EndLoc;
-          TypeResult Type = ParseClassName(EndLoc);
+          CXXScopeSpec *SS = afterCXXScope? &D.getCXXScopeSpec() : 0;
+          TypeResult Type = ParseClassName(EndLoc, SS);
           if (Type.isInvalid())
             D.SetIdentifier(0, TildeLoc);
           else

Modified: cfe/trunk/test/SemaCXX/constructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constructor.cpp?rev=74833&r1=74832&r2=74833&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/constructor.cpp (original)
+++ cfe/trunk/test/SemaCXX/constructor.cpp Mon Jul  6 11:40:48 2009
@@ -58,3 +58,28 @@
   a z; z.b(x);
 }
 }
+
+namespace A {
+  struct S {
+    S();
+    S(int);
+    void f1();
+    void f2();
+    operator int ();
+    ~S();
+  };
+}
+
+A::S::S() {}
+
+void A::S::f1() {}
+
+struct S {};
+
+A::S::S(int) {}
+
+void A::S::f2() {}
+
+A::S::operator int() { return 1; }
+
+A::S::~S() {}





More information about the cfe-commits mailing list