Fix a crash in test/Parser/control-scope.c that testrunner didn't

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.

llvm-svn: 65708
This commit is contained in:
Chris Lattner 2009-02-28 19:37:57 +00:00
parent d4ed7e8bb9
commit 309e48695b
2 changed files with 4 additions and 4 deletions

View 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;
}
}

View 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;
}