]> granicus.if.org Git - clang/commitdiff
Use isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
authorDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:04:54 +0000 (22:04 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 11 Jan 2010 22:04:54 +0000 (22:04 +0000)
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

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

index d5ca944c1d957d00ebd6c65dda48dca975f4fbae..dc91431cdd7439b97e0fbe5f8789f0215f702604 100644 (file)
@@ -832,7 +832,7 @@ void Sema::MergeTypeDefDecl(TypedefDecl *New, LookupResult &OldDecls) {
     //   };
     //
     // since that was the intent of DR56.
-    if (New->getUnderlyingType()->getAs<ElaboratedType>())
+    if (isa<ElaboratedType>(New->getUnderlyingType()))
       return;
 
     Diag(New->getLocation(), diag::err_redefinition)
index 95fb7885f7cd9a5242ae23cff9409885b648aa22..7fbd77cf59767457b22796d67b808da48cb04335 100644 (file)
@@ -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'}}
 };