From: Douglas Gregor Date: Mon, 11 Jan 2010 22:04:54 +0000 (+0000) Subject: Use isa rather than getAs, since the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39700992bf99573983ff80fc519ec51fce0f0f61;p=clang Use isa rather than getAs, since the latter may (eventually) perform multiple levels of desugaring (thus breaking the newly-added tests) and the former is faster. Thanks, John! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93192 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d5ca944c1d..dc91431cdd 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 (New->getUnderlyingType()->getAs()) + if (isa(New->getUnderlyingType())) 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 95fb7885f7..7fbd77cf59 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp @@ -2,7 +2,11 @@ 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}} + typedef struct C OtherC; + typedef OtherC C; // expected-error{{redefinition of 'C'}} };