summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/test/Parser/control-scope.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 98b8dbc9c07..c9b5405fbe1 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -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;
}
}
diff --git a/clang/test/Parser/control-scope.c b/clang/test/Parser/control-scope.c
index 3d588d63b4c..4beed7eecd3 100644
--- a/clang/test/Parser/control-scope.c
+++ b/clang/test/Parser/control-scope.c
@@ -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;
}
OpenPOWER on IntegriCloud