[clang] Add tracking source deduction guide for the explicitly-written
[llvm-project.git] / clang / test / CXX / basic / basic.scope / basic.scope.hiding / p2.cpp
blobbf8df1abee4e137230d14e4a975393308d4c116d
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 // rdar4641403
6 namespace N {
7 struct X { // expected-note{{candidate found by name lookup}}
8 float b;
9 };
12 using namespace N;
14 typedef struct {
15 int a;
16 } X; // expected-note{{candidate found by name lookup}}
19 struct Y { };
20 void Y(int) { }
22 void f() {
23 X *x; // expected-error{{reference to 'X' is ambiguous}}
24 Y(1); // okay
27 namespace PR17731 {
28 void f() {
29 struct S { S() {} };
30 int S(void);
31 int a = S();
32 struct S b;
34 int S(void);
35 int a = S();
36 struct S c = b;
39 struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}}
40 #if __cplusplus >= 201103L // C++11 or later
41 // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
42 #endif
43 int a = S(); // expected-error {{no viable conversion from 'S'}}
44 struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
47 void g() {
48 int S(void);
49 struct S { S() {} };
50 int a = S();
51 struct S b;
53 int S(void);
54 int a = S();
55 struct S c = b;
58 struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}}
59 #if __cplusplus >= 201103L // C++11 or later
60 // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}
61 #endif
62 int a = S(); // expected-error {{no viable conversion from 'S'}}
63 struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
67 struct A {
68 struct B;
69 void f();
70 int B;
72 struct A::B {};
73 void A::f() {
74 B = 123;
75 struct B b;