summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-29 16:37:40 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-29 16:37:40 +0000
commit6399366d176cac7744779674aa81523483c10b00 (patch)
treed61784b352df738e19ac82e3eea566ec69f28ac7
parente9186e6d4847a0bde56c99b6f4e1250ab1c9ad21 (diff)
downloadbcm5719-llvm-6399366d176cac7744779674aa81523483c10b00.tar.gz
bcm5719-llvm-6399366d176cac7744779674aa81523483c10b00.zip
Add a test for C++ [stmt.label]p1, from Sashan!
llvm-svn: 120291
-rw-r--r--clang/test/CXX/stmt.stmt/stmt.label/p1.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CXX/stmt.stmt/stmt.label/p1.cpp b/clang/test/CXX/stmt.stmt/stmt.label/p1.cpp
new file mode 100644
index 00000000000..f2ace35584c
--- /dev/null
+++ b/clang/test/CXX/stmt.stmt/stmt.label/p1.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f()
+{
+ int x = 0;
+ goto label1;
+
+label1: // expected-note{{previous definition is here}}
+ x = 1;
+ goto label2; // expected-error{{use of undeclared label 'label2'}}
+
+label1: // expected-error{{redefinition of label ''label1''}}
+ x = 2;
+}
+
+void h()
+{
+ int x = 0;
+ switch (x)
+ {
+ case 1:;
+ default:; // expected-error{{multiple default labels in one switch}}
+ default:; // expected-note{{previous case defined here}}
+ }
+}
OpenPOWER on IntegriCloud