]> granicus.if.org Git - clang/commitdiff
Fix a crash in test/Parser/control-scope.c that testrunner didn't
authorChris Lattner <sabre@nondot.org>
Sat, 28 Feb 2009 19:37:57 +0000 (19:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Feb 2009 19:37:57 +0000 (19:37 +0000)
notice because it was a negative test with a fix suggested by
Jean-Daniel Dupas.  Convert the test from a negative to a positive
test to catch stuff like this.

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

lib/Sema/SemaDecl.cpp
test/Parser/control-scope.c

index 98b8dbc9c0719e776d60d2754be1c5bfb280959a..c9b5405fbe1537deffb0e79b0837104d4f478684 100644 (file)
@@ -3497,7 +3497,7 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
       else
         Diag(IdLoc, diag::err_redefinition) << Id;
       Diag(PrevDecl->getLocation(), diag::note_previous_definition);
-      Val->Destroy(Context);
+      if (Val) Val->Destroy(Context);
       return 0;
     }
   }
index 3d588d63b4ccf432df89bb7d0a058fa6f07d73b3..4beed7eecd3d2ad3ca4920745b35c80412cf97d6 100644 (file)
@@ -1,8 +1,8 @@
-// RUN: not clang %s -std=c90 &&
+// RUN: clang %s -std=c90 -verify &&
 // RUN: clang %s -std=c99
 
 int f (int z) { 
-  if (z + sizeof (enum {a})) 
-    return 1 + sizeof (enum {a}); 
+  if (z + sizeof (enum {a}))        // expected-note {{previous definition is here}}
+    return 1 + sizeof (enum {a});   // expected-error {{redefinition of enumerator 'a'}}
   return 0; 
 }