blob: 3b6a9d6f8c492125e55700a8d8875381dcf1c569 [file] [log] [blame]
Fariborz Jahanian249cead2009-10-01 20:39:51 +00001// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
2
3struct R {
4 R(int);
5};
6
7struct A {
8 A(R);
9};
10
11struct B {
12 B(A);
13};
14
15int main () {
16 B(10); // expected-error {{functional-style cast from 'int' to 'struct B' is not allowed}}
17 (B)10; // expected-error {{C-style cast from 'int' to 'struct B' is not allowed}}
18 static_cast<B>(10); // expected-error {{static_cast from 'int' to 'struct B' is not allowed}} \\
19 // expected-warning {{expression result unused}}
20}
21
Douglas Gregorb653c522009-11-06 01:14:41 +000022template<class T>
23struct X0 {
24 X0(const T &);
25};
26
27template<class T>
28X0<T> make_X0(const T &Val) {
29 return X0<T>(Val);
30}
31
32void test_X0() {
33 const char array[2];
34 make_X0(array);
35}
Douglas Gregor27591ff2009-11-06 05:48:00 +000036
37// PR5210 recovery
38class C {
39protected:
40 template <int> float* &f0(); // expected-note{{candidate}}
41 template <unsigned> float* &f0(); // expected-note{{candidate}}
42
43 void f1() {
44 static_cast<float*>(f0<0>()); // expected-error{{ambiguous}}
45 }
46};