blob: 57bf4095afd0a65e2dc1c1f7c3c0bf5185961127 [file] [log] [blame]
Douglas Gregor6d507a62009-05-07 17:50:16 +00001// RUN: clang-cc -fsyntax-only -pedantic -verify %s
2
3// [dcl.ambig.res]p1:
4struct S {
5 S(int);
6 void bar();
7};
8
9int returns_an_int();
10
11void foo(double a)
12{
13 S w(int(a)); // expected-warning{{disambiguated}}
14 w(17);
15 S x(int()); // expected-warning{{disambiguated}}
16 x(&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:
24char *p;
25void *operator new(__SIZE_TYPE__, int);
26void 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:
33template <class T> // expected-note{{here}}
34struct S4 {
35 T *p;
36};
37S4<int()> x; //type-id
38S4<int(1)> y; // expected-error{{must be a type}}
39
40// [dcl.ambig.res]p5:
41void 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:
50void foo6()
51{
52 (void)(int(1)); //expression
53 (void)(int())1; // expected-error{{used type}}
54}
55
56// [dcl.ambig.res]p7:
57class C7 { };
58void f7(int(C7)) { } // expected-note{{candidate}}
59int g7(C7);
60void foo7() {
61 f7(1); // expected-error{{no matching function}}
62 f7(g7); //OK
63}
64
65void h7(int *(C7[10])) { } // expected-note{{previous}}
66void h7(int *(*_fp)(C7 _parm[10])) { } // expected-error{{redefinition}}