1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 struct A
{ // expected-note {{candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}}
6 #if __cplusplus >= 201103L
7 // expected-note@-2 {{candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}}
9 A
&operator=(void*); // expected-note {{candidate function not viable: 'this' argument has type 'const test0::A', but method is not marked const}}
12 void test(const A
&a
) {
13 a
= "help"; // expected-error {{no viable overloaded '='}}
23 #if __cplusplus < 201103L
24 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
25 // expected-error@-3 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'void'}}
30 namespace warn_if_best
{
36 #if __cplusplus < 201103L
37 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
39 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
44 namespace userdefined_vs_illformed
{
45 struct X
{ X(const char *); };
47 void *f(char *p
); // best for C++03
48 double f(X x
); // best for C++11
52 #if __cplusplus < 201103L
53 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
54 // expected-error@-3 {{cannot initialize a variable of type 'double' with an rvalue of type 'void *'}}
59 namespace sfinae_test
{
63 struct S
{ typedef int type
; };
66 struct S
<sizeof(int)> { typedef void type
; };
68 // C++11: SFINAE failure
70 template<typename T
> int cxx11_ignored(T
, typename S
<sizeof(f(T(), "foo"))>::type
*);
71 #if __cplusplus < 201103L
72 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
74 // expected-note@-4 {{candidate template ignored: substitution failure}}
77 // C++11: better than latter
78 // C++03: worse than latter
79 template<typename T
> void g(T
, ...);
80 template<typename T
> int g(T
, typename S
<sizeof(f(T(), "foo"))>::type
*);
81 #if __cplusplus < 201103L
82 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
85 int a
= cxx11_ignored(0, 0);
87 #if __cplusplus >= 201103L
88 // expected-error@-3 {{no matching function for call to 'cxx11_ignored'}}
89 // expected-error@-3 {{cannot initialize a variable of type 'int' with an rvalue of type 'void'}}