aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/goto.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-14 21:19:51 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-14 21:19:51 +0000
commit7cbc558ffda5877ec4d2e432534e3d3d4ac10050 (patch)
treeda94f5bf295b07b01b82017c6f96caf478ddb6f0 /test/SemaCXX/goto.cpp
parentdc0f137295bc7ec5b231ff1842388f149f43c0c8 (diff)
When synthesizing a label declaration based on a goto statement that
cannot yet be resolved, be sure to push the new label declaration into the right place within the identifier chain. Otherwise, name lookup in C++ gets confused when searching for names that are lexically closer than the label. Fixes PR9463. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127623 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/goto.cpp')
-rw-r--r--test/SemaCXX/goto.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaCXX/goto.cpp b/test/SemaCXX/goto.cpp
new file mode 100644
index 0000000000..2db9d97fd8
--- /dev/null
+++ b/test/SemaCXX/goto.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR9463
+double *end;
+void f() {
+ {
+ int end = 0;
+ goto end;
+ end = 1;
+ }
+
+ end:
+ return;
+}
+
+void g() {
+ end = 1; // expected-error{{assigning to 'double *' from incompatible type 'int'}}
+}