]> granicus.if.org Git - clang/commitdiff
Just because a declaration has the same name as its containing class doesn't mean...
authorAnders Carlsson <andersca@mac.com>
Wed, 29 Apr 2009 23:19:39 +0000 (23:19 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 29 Apr 2009 23:19:39 +0000 (23:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70436 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/SemaCXX/constructor.cpp

index ec8923a23b2dbc082fcda8115b58b16097bd7539..59e9ed6acbefc509e466a378a6ee21d086071bfb 100644 (file)
@@ -1982,16 +1982,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
 
       if (Tok.is(tok::identifier)) {
         assert(Tok.getIdentifierInfo() && "Not an identifier?");
-
-        // If this identifier is the name of the current class, it's a
-        // constructor name. 
-        if (Actions.isCurrentClassName(*Tok.getIdentifierInfo(),CurScope)){
-          D.setConstructor(Actions.getTypeName(*Tok.getIdentifierInfo(),
-                                               Tok.getLocation(), CurScope),
-                           Tok.getLocation());
-        // This is a normal identifier.
-        } else
-          D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
+        D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
         ConsumeToken();
         goto PastIdentifier;
       } else if (Tok.is(tok::annot_template_id)) {
@@ -2101,6 +2092,15 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
           break;
       }
       ParseFunctionDeclarator(ConsumeParen(), D);
+      
+      // If this identifier is the name of the current class, it's a
+      // constructor name. 
+      if (IdentifierInfo *II = D.getIdentifier()) {
+        if (Actions.isCurrentClassName(*II, CurScope))
+        D.setConstructor(Actions.getTypeName(*II, D.getIdentifierLoc(), 
+                                             CurScope), 
+                         D.getIdentifierLoc());
+      } 
     } else if (Tok.is(tok::l_square)) {
       ParseBracketDeclarator(D);
     } else {
index eae51467961275d1bd6cf4d524aa50578946f8d0..1429cc64527797774de01a4e41edec9c0d3caaa5 100644 (file)
@@ -40,3 +40,8 @@ extern y b;
 struct Length {
   Length l() const { return *this; }
 };
+
+// <rdar://problem/6815988>
+struct mmst_reg{
+ char mmst_reg[10];
+};