From: Douglas Gregor Date: Mon, 11 Jan 2010 22:30:10 +0000 (+0000) Subject: C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=05f650001bc66c2dc238e7cee709cb7896bd8a37;p=clang C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that 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 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index dc91431cdd..d2f254c718 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -832,7 +832,7 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls) { // }; // // since that was the intent of DR56. - if (isa(New->getUnderlyingType())) + if (!isa(Old)) return; Diag(New->getLocation(), diag::err_redefinition) diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp index 7fbd77cf59..c16ba201df 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp @@ -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; };