• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2 
3 // [dcl.ambig.res]p1:
4 struct S {
5   S(int);
6   void bar();
7 };
8 
9 int returns_an_int();
10 
foo(double a)11 void foo(double a)
12 {
13   S w(int(a)); // expected-warning{{disambiguated}}
14   w(17);
15   S x1(int()); // expected-warning{{disambiguated}}
16   x1(&returns_an_int);
17   S y((int)a);
18   y.bar();
19   S z = int(a);
20   z.bar();
21 }
22 
23 // [dcl.ambig.res]p3:
24 char *p;
25 void *operator new(__SIZE_TYPE__, int);
foo3()26 void foo3() {
27   const int x = 63;
28   new (int(*p)) int; //new-placement expression
29   new (int(*[x])); //new type-id
30 }
31 
32 // [dcl.ambig.res]p4:
33 template <class T>  // expected-note{{here}}
34 struct S4 {
35   T *p;
36 };
37 S4<int()> x; //type-id
38 S4<int(1)> y; // expected-error{{must be a type}}
39 
40 // [dcl.ambig.res]p5:
foo5()41 void foo5()
42 {
43   (void)sizeof(int(1)); //expression
44   // FIXME: should we make this an error rather than a warning?
45   // (It affects SFINAE)
46   (void)sizeof(int()); // expected-warning{{function type}}
47 }
48 
49 // [dcl.ambig.res]p6:
foo6()50 void foo6()
51 {
52   (void)(int(1)); //expression
53   (void)(int())1; // expected-error{{to 'int ()'}}
54 }
55 
56 // [dcl.ambig.res]p7:
57 class C7 { };
f7(int (C7))58 void f7(int(C7)) { } // expected-note{{candidate}}
59 int g7(C7);
foo7()60 void foo7() {
61   f7(1); // expected-error{{no matching function}}
62   f7(g7); //OK
63 }
64 
h7(int * (C7[10]))65 void h7(int *(C7[10])) { } // expected-note{{previous}}
h7(int * (* _fp)(C7 _parm[10]))66 void h7(int *(*_fp)(C7 _parm[10])) { } // expected-error{{redefinition}}
67 
68 struct S5 {
69   static bool const value = false;
70 };
foo8()71 int foo8() {
72   int v(int(S5::value)); // expected-warning{{disambiguated}} expected-error{{parameter declarator cannot be qualified}}
73 }
74 
75 template<typename T>
76 void rdar8739801( void (T::*)( void ) __attribute__((unused)) );
77