diff options
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/altivec.c | 34 | ||||
-rw-r--r-- | test/Parser/backtrack-crash.cpp | 4 | ||||
-rw-r--r-- | test/Parser/bracket-crash.cpp | 6 | ||||
-rw-r--r-- | test/Parser/cxx-altivec.cpp | 25 | ||||
-rw-r--r-- | test/Parser/cxx-class.cpp | 2 | ||||
-rw-r--r-- | test/Parser/cxx-decl.cpp | 4 | ||||
-rw-r--r-- | test/Parser/cxx-undeclared-identifier.cpp | 3 | ||||
-rw-r--r-- | test/Parser/declarators.c | 11 | ||||
-rw-r--r-- | test/Parser/objc-try-catch-1.m | 6 | ||||
-rw-r--r-- | test/Parser/pragma-options.c | 2 |
10 files changed, 82 insertions, 15 deletions
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c index ed144573fcd2..92ec688bc01d 100644 --- a/test/Parser/altivec.c +++ b/test/Parser/altivec.c @@ -13,7 +13,9 @@ __vector int vv_i; __vector signed int vv_sint; __vector unsigned int vv_ui; __vector float vv_f; -__vector bool vv_b; +__vector bool char vv_bc; +__vector bool short vv_bs; +__vector bool int vv_bi; __vector __pixel vv_p; __vector pixel vv__p; __vector int vf__r(); @@ -33,7 +35,9 @@ vector int v_i; vector signed int v_sint; vector unsigned int v_ui; vector float v_f; -vector bool v_b; +vector bool char v_bc; +vector bool short v_bs; +vector bool int v_bi; vector __pixel v_p; vector pixel v__p; vector int f__r(); @@ -57,14 +61,20 @@ vector signed long int v_sli; // expected-warning {{Use of 'long' with '__ vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} __vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool v_b; // expected-warning {{type specifier missing, defaults to 'int'}} // These should have errors. -__vector double vv_d; // expected-error {{cannot use 'double' with '__vector'}} -__vector double vv_d; // expected-error {{cannot use 'double' with '__vector'}} -vector double v_d; // expected-error {{cannot use 'double' with '__vector'}} -vector double v_d; // expected-error {{cannot use 'double' with '__vector'}} -__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} -vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}} +vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}} +vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}} +vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}} +vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}} +vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} +vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} void f() { __vector unsigned int v = {0,0,0,0}; @@ -91,3 +101,11 @@ void f() { gccv = v; gccvector unsigned int tgv = v; } + +// bug 6895 - Vectorl literal casting confusion. +vector char v1 = (vector char)((vector int)(1, 2, 3, 4));
+vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f));
+vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
+vector int v4 = (vector int)(1, 2, 3, 4);
+vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f); +vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3))); diff --git a/test/Parser/backtrack-crash.cpp b/test/Parser/backtrack-crash.cpp new file mode 100644 index 000000000000..cc2687372969 --- /dev/null +++ b/test/Parser/backtrack-crash.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic +// PR7072 +()( // expected-error {{expected unqualified-id}} + diff --git a/test/Parser/bracket-crash.cpp b/test/Parser/bracket-crash.cpp new file mode 100644 index 000000000000..fd18e0e25fef --- /dev/null +++ b/test/Parser/bracket-crash.cpp @@ -0,0 +1,6 @@ +// RUN: not %clang_cc1 -fsyntax-only %s +// PR7481 +struct{ + a +} + diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index 66d4f3263b9a..a70eea077e7a 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s -// This is the same as the C version: __vector char vv_c; __vector signed char vv_sc; @@ -14,7 +13,9 @@ __vector int vv_i; __vector signed int vv_sint; __vector unsigned int vv_ui; __vector float vv_f; -__vector bool vv_b; +__vector bool char vv_bc; +__vector bool short vv_bs; +__vector bool int vv_bi; __vector __pixel vv_p; __vector pixel vv__p; __vector int vf__r(); @@ -34,7 +35,9 @@ vector int v_i; vector signed int v_sint; vector unsigned int v_ui; vector float v_f; -vector bool v_b; +vector bool char v_bc; +vector bool short v_bs; +vector bool int v_bi; vector __pixel v_p; vector pixel v__p; vector int f__r(); @@ -64,6 +67,14 @@ __vector double vv_d1; // expected-error {{cannot use 'double' wit vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} __vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool v_b; // expected-error {{error: C++ requires a type specifier for all declarations}} +vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}} +vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}} +vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}} +vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}} +vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}} +vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} +vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} void f() { __vector unsigned int v = {0,0,0,0}; @@ -107,3 +118,11 @@ class c_v { void f__a2(int b, vector int a); }; + +// bug 6895 - Vectorl literal casting confusion. +vector char v1 = (vector char)((vector int)(1, 2, 3, 4)); +vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f)); +vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd')); +vector int v4 = (vector int)(1, 2, 3, 4); +vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f); +vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3))); diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 4abbbc5b9b58..57831a463b9b 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -7,7 +7,7 @@ protected: static int sf(), u; struct S {}; - enum {}; + enum {}; // expected-warning{{declaration does not declare anything}} int; // expected-warning {{declaration does not declare anything}} int : 1, : 2; diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index ae004ce81c1d..e4c703c334bd 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -37,6 +37,10 @@ class someclass { } }; +class asm_class_test { + void foo() __asm__("baz"); +}; + enum { fooenum = 1 }; struct a { diff --git a/test/Parser/cxx-undeclared-identifier.cpp b/test/Parser/cxx-undeclared-identifier.cpp index 36d8f7a65381..f15deabc6da5 100644 --- a/test/Parser/cxx-undeclared-identifier.cpp +++ b/test/Parser/cxx-undeclared-identifier.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s +// PR7180 +int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}} + class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \ // expected-note {{to match this '{'}} \ // expected-error {{expected ';' after class}} diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c index 31712af26c74..fb69fa9c1d05 100644 --- a/test/Parser/declarators.c +++ b/test/Parser/declarators.c @@ -83,3 +83,14 @@ void test12() { // rdar://7608537 struct test13 { int a; } (test13x); + +// <rdar://problem/8044088> +struct X<foo::int> { }; // expected-error{{expected identifier or '('}} + + +// PR7617 - error recovery on missing ;. + +void test14() // expected-error {{expected ';' after top level declarator}} + +void test14a(); +void *test14b = (void*)test14a; // Make sure test14a didn't get skipped. diff --git a/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m index 1934cbd3b83d..719369124e5c 100644 --- a/test/Parser/objc-try-catch-1.m +++ b/test/Parser/objc-try-catch-1.m @@ -27,13 +27,15 @@ void * foo() return proc(); } @catch (Frob* ex) { - @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}} + @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}} \ + // expected-warning {{expression result unused}} } @catch (float x) { // expected-error {{@catch parameter is not a pointer to an interface type}} } @catch(...) { - @throw (4,3,proc()); + @throw (4,3,proc()); // expected-warning {{expression result unused}} \ + // expected-warning {{expression result unused}} } } diff --git a/test/Parser/pragma-options.c b/test/Parser/pragma-options.c index 332249fdcfe3..daf385dddba7 100644 --- a/test/Parser/pragma-options.c +++ b/test/Parser/pragma-options.c @@ -9,4 +9,4 @@ #pragma options align=natural #pragma options align=reset #pragma options align=mac68k -/* expected-warning {{unsupported alignment option}} */ #pragma options align=power +#pragma options align=power |