diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/constructor.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/implicit-int.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/invalid-member-expr.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/invalid-template-specifier.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/new-delete.cpp | 1 | ||||
-rw-r--r-- | test/SemaCXX/overloaded-operator.cpp | 28 | ||||
-rw-r--r-- | test/SemaCXX/ptrtomember-badcall.cpp | 13 | ||||
-rw-r--r-- | test/SemaCXX/typedef-redecl.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/value-initialization.cpp | 10 |
10 files changed, 61 insertions, 9 deletions
diff --git a/test/SemaCXX/constructor.cpp b/test/SemaCXX/constructor.cpp index 5ce595cdcece..58d28b55184c 100644 --- a/test/SemaCXX/constructor.cpp +++ b/test/SemaCXX/constructor.cpp @@ -14,7 +14,7 @@ class Foo { static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}} virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}} Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}} - + int Foo(int, int); // expected-error{{constructor cannot have a return type}} }; diff --git a/test/SemaCXX/implicit-int.cpp b/test/SemaCXX/implicit-int.cpp index 6fa8dd3463d3..723030516dee 100644 --- a/test/SemaCXX/implicit-int.cpp +++ b/test/SemaCXX/implicit-int.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s x; // expected-error{{C++ requires a type specifier for all declarations}} diff --git a/test/SemaCXX/invalid-member-expr.cpp b/test/SemaCXX/invalid-member-expr.cpp index 90932ed65e31..730beb32698b 100644 --- a/test/SemaCXX/invalid-member-expr.cpp +++ b/test/SemaCXX/invalid-member-expr.cpp @@ -5,8 +5,8 @@ class X {}; void test() { X x; - x.int; // expected-error{{expected identifier}} - x.~int(); // expected-error{{expected identifier}} + x.int; // expected-error{{expected unqualified-id}} + x.~int(); // expected-error{{expected the class name}} x.operator; // expected-error{{missing type specifier after 'operator'}} x.operator typedef; // expected-error{{missing type specifier after 'operator'}} } @@ -14,8 +14,8 @@ void test() { void test2() { X *x; - x->int; // expected-error{{expected identifier}} - x->~int(); // expected-error{{expected identifier}} + x->int; // expected-error{{expected unqualified-id}} + x->~int(); // expected-error{{expected the class name}} x->operator; // expected-error{{missing type specifier after 'operator'}} x->operator typedef; // expected-error{{missing type specifier after 'operator'}} } diff --git a/test/SemaCXX/invalid-template-specifier.cpp b/test/SemaCXX/invalid-template-specifier.cpp index a3f081ff60b5..034ad73b086a 100644 --- a/test/SemaCXX/invalid-template-specifier.cpp +++ b/test/SemaCXX/invalid-template-specifier.cpp @@ -8,5 +8,5 @@ const template basic_istream<char>; // expected-error {{expected unqualified-id} namespace S {} template <class X> class Y { void x() { S::template y<char>(1); } // expected-error {{does not refer to a template}} \ - // expected-error {{no member named 'y'}} + // expected-error {{unqualified-id}} }; diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 5178557030b7..721758f4cae0 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s +// RUN: clang-cc -fsyntax-only -std=c++98 -verify -fms-extensions=0 %s namespace A { struct C { static int cx; diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index c67a3f653900..6f3e9effe538 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -58,6 +58,7 @@ void bad_news(int *ip) (void)new int[1.1]; // expected-error {{array size expression must have integral or enumerated type, not 'double'}} (void)new int[1][i]; // expected-error {{only the first dimension}} (void)new (int[1][i]); // expected-error {{only the first dimension}} + (void)new (int[i]); // expected-error {{when type is in parentheses}} (void)new int(*(S*)0); // expected-error {{incompatible type initializing}} (void)new int(1, 2); // expected-error {{initializer of a builtin type can only take one argument}} (void)new S(1); // expected-error {{no matching constructor}} diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 10b0f5a76804..0f723ad206b9 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -70,6 +70,34 @@ void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) { float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a temporary of type 'bool'}} } +// PR5244 - Argument-dependent lookup would include the two operators below, +// which would break later assumptions and lead to a crash. +class pr5244_foo +{ + pr5244_foo(int); + pr5244_foo(char); +}; + +bool operator==(const pr5244_foo& s1, const pr5244_foo& s2); +bool operator==(char c, const pr5244_foo& s); + +enum pr5244_bar +{ + pr5244_BAR +}; + +class pr5244_baz +{ + pr5244_bar quux; +}; + +void pr5244_barbaz() +{ + pr5244_baz quuux; + (void)(pr5244_BAR == quuux.quux); +} + + struct PostInc { PostInc operator++(int); diff --git a/test/SemaCXX/ptrtomember-badcall.cpp b/test/SemaCXX/ptrtomember-badcall.cpp new file mode 100644 index 000000000000..42b8e3b6e0c9 --- /dev/null +++ b/test/SemaCXX/ptrtomember-badcall.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +struct S { + int i; + + int mem(int); +}; + +int foo(int S::* ps, S *s) +{ + return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}} +} + diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp index e38f47436d1c..85944a661d41 100644 --- a/test/SemaCXX/typedef-redecl.cpp +++ b/test/SemaCXX/typedef-redecl.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s typedef int INT; typedef INT REALLY_INT; // expected-note {{previous definition is here}} typedef REALLY_INT REALLY_REALLY_INT; diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp new file mode 100644 index 000000000000..29d866fa64de --- /dev/null +++ b/test/SemaCXX/value-initialization.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +struct A { + const int i; // expected-note {{declared at}} + virtual void f() { } +}; + +int main () { + (void)A(); // expected-error {{cannot define the implicit default constructor for 'struct A', because const member 'i' cannot be default-initialized}} +} |