summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/cxx-undeclared-identifier.cpp6
-rw-r--r--test/Parser/namespaces.cpp8
-rw-r--r--test/Parser/pragma-options.c12
-rw-r--r--test/Parser/recovery.c5
-rw-r--r--test/Parser/switch-recovery.cpp12
5 files changed, 43 insertions, 0 deletions
diff --git a/test/Parser/cxx-undeclared-identifier.cpp b/test/Parser/cxx-undeclared-identifier.cpp
new file mode 100644
index 0000000..36d8f7a
--- /dev/null
+++ b/test/Parser/cxx-undeclared-identifier.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
+ // expected-note {{to match this '{'}} \
+ // expected-error {{expected ';' after class}}
+ // expected-error {{expected '}'}}
diff --git a/test/Parser/namespaces.cpp b/test/Parser/namespaces.cpp
new file mode 100644
index 0000000..b8c7819
--- /dev/null
+++ b/test/Parser/namespaces.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR6596
+namespace g { enum { o = 0 }; }
+
+void foo() {
+ namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
+}
diff --git a/test/Parser/pragma-options.c b/test/Parser/pragma-options.c
new file mode 100644
index 0000000..332249f
--- /dev/null
+++ b/test/Parser/pragma-options.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+
+/* expected-warning {{expected 'align' following '#pragma options'}} */ #pragma options
+/* expected-warning {{expected '=' following '#pragma options align'}} */ #pragma options align
+/* expected-warning {{expected identifier in '#pragma options'}} */ #pragma options align =
+/* expected-warning {{invalid alignment option in '#pragma options align'}} */ #pragma options align = foo
+/* expected-warning {{extra tokens at end of '#pragma options'}} */ #pragma options align = reset foo
+
+#pragma options align=natural
+#pragma options align=reset
+#pragma options align=mac68k
+/* expected-warning {{unsupported alignment option}} */ #pragma options align=power
diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c
index 8e7181e..6cd95da 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -73,3 +73,8 @@ void foo() {
int X;
X = 4 // expected-error{{expected ';' after expression}}
}
+
+
+// rdar://7980651
+typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
+void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp
new file mode 100644
index 0000000..8eb4cff
--- /dev/null
+++ b/test/Parser/switch-recovery.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/7971948>
+struct A {};
+struct B {
+ void foo() {
+ switch (a) { // expected-error{{use of undeclared identifier 'a'}}
+ default:
+ return;
+ }
+ }
+};
OpenPOWER on IntegriCloud