• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
2 
3 struct R {
4   R(int);
5 };
6 
7 struct A {
8   A(R);
9 };
10 
11 struct B { // expected-note 3 {{candidate constructor (the implicit copy constructor) not viable}}
12   B(A); // expected-note 3 {{candidate constructor not viable}}
13 };
14 
main()15 int main () {
16   B(10);	// expected-error {{no matching conversion for functional-style cast from 'int' to 'B'}}
17   (B)10;	// expected-error {{no matching conversion for C-style cast from 'int' to 'B'}}
18   static_cast<B>(10);	// expected-error {{no matching conversion for static_cast from 'int' to 'B'}} \\
19 			// expected-warning {{expression result unused}}
20 }
21 
22 template<class T>
23 struct X0 {
24   X0(const T &);
25 };
26 
27 template<class T>
make_X0(const T & Val)28 X0<T> make_X0(const T &Val) {
29   return X0<T>(Val);
30 }
31 
test_X0()32 void test_X0() {
33   const char array[2] = { 'a', 'b' };
34   make_X0(array);
35 }
36 
37 // PR5210 recovery
38 class C {
39 protected:
40   template <int> float* &f0(); // expected-note{{candidate}}
41   template <unsigned> float* &f0(); // expected-note{{candidate}}
42 
f1()43   void f1() {
44     static_cast<float*>(f0<0>()); // expected-error{{ambiguous}}
45   }
46 };
47