1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
7 explicit X(const X
&); // expected-note 2{{not a candidate}}
8 X(int*); // expected-note 3{{candidate constructor}}
9 explicit X(float*); // expected-note {{candidate constructor}} expected-note 2{{not a candidate}}
12 class Y
: public X
{ };
14 void f(Y y
, int *ip
, float *fp
) {
15 X x1
= y
; // expected-error{{no matching constructor for initialization of 'X'}}
18 X x4
= fp
; // expected-error{{no viable conversion}}
19 X
x2a(0); // expected-error{{call to constructor of 'X' is ambiguous}}
25 void bar(); // expected-note{{declared here}}
29 void test(const foo
*P
) { P
->bar(); } // expected-error{{'this' argument to member function 'bar' has type 'const foo', but function is not marked const}}
33 Foo(); // expected-note{{not viable}}
34 Foo(Foo
&); // expected-note{{candidate constructor not viable}}
38 operator const Foo
&() const;
44 f(Bar()); // expected-error{{no viable constructor copying parameter of type 'const Foo'}}
50 // Core issue 5: if a temporary is created in copy-initialization, it is of
51 // the cv-unqualified version of the destination type.
59 const volatile A a
= c
; // ok
65 #if __cplusplus <= 199711L // C++03 or earlier modes
66 // expected-warning@-2 {{rvalue references are a C++11 extension}}
82 B b
= 0; // ok, calls B(int) then A(const A&) then B(A).