diff options
Diffstat (limited to 'test/SemaCXX/overload-call.cpp')
-rw-r--r-- | test/SemaCXX/overload-call.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 19ce144..3d286a9 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -pedantic -verify %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify -std=c++98 %s +// RUN: %clang_cc1 -triple %itanium_abi_triple -pedantic -verify -std=c++11 %s + int* f(int) { return 0; } float* f(float) { return 0; } void f(); @@ -53,8 +56,19 @@ int* k(char*); double* k(bool); void test_k() { - int* ip1 = k("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}} - int* ip2 = k(("foo")); // expected-warning{{conversion from string literal to 'char *' is deprecated}} + int* ip1 = k("foo"); +#if __cplusplus <= 199711L + // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}} +#else + // expected-error@-4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}} +#endif + + int* ip2 = k(("foo")); +#if __cplusplus <= 199711L + // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}} +#else + // expected-error@-4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}} +#endif double* dp1 = k(L"foo"); } @@ -62,7 +76,12 @@ int* l(wchar_t*); double* l(bool); void test_l() { - int* ip1 = l(L"foo"); // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}} + int* ip1 = l(L"foo"); +#if __cplusplus <= 199711L + // expected-warning@-2 {{conversion from string literal to 'wchar_t *' is deprecated}} +#else + // expected-error@-4 {{cannot initialize a variable of type 'int *' with an rvalue of type 'double *'}} +#endif double* dp1 = l("foo"); } @@ -80,8 +99,12 @@ class E; void test_n(E* e) { char ca[7]; int* ip1 = n(ca); - int* ip2 = n("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}} - + int* ip2 = n("foo"); +#if __cplusplus <= 199711L + // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}} +#else + // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'char *'}} +#endif float fa[7]; double* dp1 = n(fa); @@ -593,8 +616,16 @@ void test5() { namespace PR20218 { void f(void (*const &)()); // expected-note 2{{candidate}} - void f(void (&&)()) = delete; // expected-note 2{{candidate}} expected-warning 2{{extension}} - void g(void (&&)()) = delete; // expected-note 2{{candidate}} expected-warning 2{{extension}} + void f(void (&&)()) = delete; // expected-note 2{{candidate}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{rvalue references are a C++11 extension}} + // expected-warning@-3 {{deleted function definitions are a C++11 extension}} +#endif + void g(void (&&)()) = delete; // expected-note 2{{candidate}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{rvalue references are a C++11 extension}} + // expected-warning@-3 {{deleted function definitions are a C++11 extension}} +#endif void g(void (*const &)()); // expected-note 2{{candidate}} void x(); |