summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/test/SemaCXX/goto.cpp14
2 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a6c154338f4..6f98461f44d 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -500,7 +500,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) {
// isn't strictly lexical, which breaks name lookup. Be careful to insert
// the label at the appropriate place in the identifier chain.
for (I = IdResolver.begin(D->getDeclName()); I != IEnd; ++I) {
- DeclContext *IDC = (*I)->getLexicalDeclContext();
+ DeclContext *IDC = (*I)->getLexicalDeclContext()->getRedeclContext();
if (IDC == CurContext) {
if (!S->isDeclScope(*I))
continue;
diff --git a/clang/test/SemaCXX/goto.cpp b/clang/test/SemaCXX/goto.cpp
index b2b1e6f391f..d8d5ec51f6e 100644
--- a/clang/test/SemaCXX/goto.cpp
+++ b/clang/test/SemaCXX/goto.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall -fblocks %s
// PR9463
double *end;
@@ -57,7 +57,7 @@ void h2(int end) {
end:
::end = 0;
}
- end:
+ end: // expected-warning{{unused label 'end'}}
end = 1;
}
@@ -92,4 +92,14 @@ namespace PR9495 {
}
}
+extern "C" {
+ void exit(int);
+}
+void f() {
+ {
+ goto exit;
+ }
+ exit:
+ return;
+}
OpenPOWER on IntegriCloud