1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
5 #if __cplusplus >= 201103L
6 // expected-note@+3 2 {{candidate constructor}}
7 // expected-note@+2 {{passing argument to parameter here}}
12 struct ConvertibleToA
{
16 struct ConvertibleToConstA
{
17 #if __cplusplus >= 201103L
18 // expected-note@+2 {{candidate function}}
24 B
& operator=(B
&); // expected-note 4 {{candidate function}}
27 struct ConvertibleToB
{
31 struct ConvertibleToBref
{
35 struct ConvertibleToConstB
{
39 struct ConvertibleToConstBref
{
44 int operator=(int); // expected-note{{candidate function}}
45 long operator=(long); // expected-note{{candidate function}}
46 int operator+=(int); // expected-note{{candidate function}}
47 int operator+=(long); // expected-note{{candidate function}}
51 D
& operator+=(const D
&);
54 struct ConvertibleToInt
{
61 ConvertibleToA convertibleToA
;
62 ConvertibleToConstA convertibleToConstA
;
66 ConvertibleToB convertibleToB
;
67 ConvertibleToBref convertibleToBref
;
68 ConvertibleToConstB convertibleToConstB
;
69 ConvertibleToConstBref convertibleToConstBref
;
77 ConvertibleToInt convertibleToInt
;
82 #if __cplusplus >= 201103L
83 // expected-error@+2 {{no viable conversion}}
85 na
= convertibleToConstA
;
86 na
+= a
; // expected-error{{no viable overloaded '+='}}
89 nb
= constB
; // expected-error{{no viable overloaded '='}}
90 nb
= convertibleToB
; // expected-error{{no viable overloaded '='}}
91 nb
= convertibleToBref
;
92 nb
= convertibleToConstB
; // expected-error{{no viable overloaded '='}}
93 nb
= convertibleToConstBref
; // expected-error{{no viable overloaded '='}}
99 nc
= 1.0; // expected-error{{use of overloaded operator '=' is ambiguous}}
102 nc
+= 1.0; // expected-error{{use of overloaded operator '+=' is ambiguous}}
109 i
= convertibleToInt
;
110 i
= a
; // expected-error{{assigning to 'int' from incompatible type 'A'}}
113 // <rdar://problem/8315440>: Don't crash
115 template<typename T
> class A
: public unknown::X
{ // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}}
116 A(UndeclaredType n
) : X(n
) {} // expected-error {{unknown type name 'UndeclaredType'}}
117 // expected-error@-1 {{member initializer 'X' does not name a non-static data member or base class}}
119 template<typename T
> class B
: public A
<T
> {
120 virtual void foo() {}
122 extern template class A
<char>;
123 extern template class B
<char>;