]> granicus.if.org Git - clang/blobdiff - lib/Sema/SemaDecl.cpp
Reapply "[Modules] Fix regression when an elaborated-type-specifier mentions a hidden...
[clang] / lib / Sema / SemaDecl.cpp
index 6a61ac0e44ce0de55052d5314f8975c89144d922..f9c1a0142602fd30d0e4159f224124cc4d619952 100644 (file)
@@ -12136,9 +12136,16 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
 
     // In C++, we need to do a redeclaration lookup to properly
     // diagnose some problems.
+    // FIXME: redeclaration lookup is also used (with and without C++) to find a
+    // hidden declaration so that we don't get ambiguity errors when using a
+    // type declared by an elaborated-type-specifier.  In C that is not correct
+    // and we should instead merge compatible types found by lookup.
     if (getLangOpts().CPlusPlus) {
       Previous.setRedeclarationKind(ForRedeclaration);
       LookupQualifiedName(Previous, SearchDC);
+    } else {
+      Previous.setRedeclarationKind(ForRedeclaration);
+      LookupName(Previous, S);
     }
   }