1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 // rdar4641403
4 namespace N {
5   struct X { // expected-note{{candidate found by name lookup}}
6     float b;
7   };
8 }
9 
10 using namespace N;
11 
12 typedef struct {
13   int a;
14 } X; // expected-note{{candidate found by name lookup}}
15 
16 
17 struct Y { };
18 void Y(int) { }
19 
20 void f() {
21   X *x; // expected-error{{reference to 'X' is ambiguous}}
22   Y(1); // okay
23 }
24 
25 namespace PR17731 {
26   void f() {
27     struct S { S() {} };
28     int S(void);
29     int a = S();
30     struct S b;
31     {
32       int S(void);
33       int a = S();
34       struct S c = b;
35     }
36     {
37       struct S { S() {} }; // expected-note {{candidate}}
38       int a = S(); // expected-error {{no viable conversion from 'S'}}
39       struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
40     }
41   }
42   void g() {
43     int S(void);
44     struct S { S() {} };
45     int a = S();
46     struct S b;
47     {
48       int S(void);
49       int a = S();
50       struct S c = b;
51     }
52     {
53       struct S { S() {} }; // expected-note {{candidate}}
54       int a = S(); // expected-error {{no viable conversion from 'S'}}
55       struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
56     }
57   }
58 
59   struct A {
60     struct B;
61     void f();
62     int B;
63   };
64   struct A::B {};
65   void A::f() {
66     B = 123;
67     struct B b;
68   }
69 }
70