]> granicus.if.org Git - clang/commitdiff
C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that
authorDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:30:10 +0000 (22:30 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:30:10 +0000 (22:30 +0000)
is not also a typedef-name" actually means. For anyone keeping score,
that's John: 2, Doug: 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93196 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp

index dc91431cdd7439b97e0fbe5f8789f0215f702604..d2f254c718462613afd88a412c6157d6bea94f0a 100644 (file)
@@ -832,7 +832,7 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls) {
     //   };
     //
     // since that was the intent of DR56.
-    if (isa<ElaboratedType>(New->getUnderlyingType()))
+    if (!isa<TypedefDecl >(Old))
       return;
 
     Diag(New->getLocation(), diag::err_redefinition)
index 7fbd77cf59767457b22796d67b808da48cb04335..c16ba201df7243506065c5104bb362f8de432b1d 100644 (file)
@@ -2,11 +2,14 @@
 
 struct S {
   typedef struct A {} A; // expected-note {{previous definition is here}}
-  typedef struct B {} B;
+  typedef struct B B;
   typedef A A; // expected-error {{redefinition of 'A'}}
 
-  struct C { }; // expected-note{{previous definition is here}}
+  struct C { };
   typedef struct C OtherC;
-  typedef OtherC C; // expected-error{{redefinition of 'C'}}
+  typedef OtherC C;
+
+  typedef struct D { } D2;
+  typedef D2 D;
 };