[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / CXX / basic / basic.lookup / basic.lookup.qual / namespace.qual / p2.cpp
blob73c043fec4057bb7af7f83ba625ac30c24b75229
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 namespace Ints {
6 int zero = 0; // expected-note {{candidate found by name lookup is 'Ints::zero'}}
7 void f(int); // expected-note 3 {{candidate function}}
8 void g(int);
11 namespace Floats {
12 float zero = 0.0f; // expected-note {{candidate found by name lookup is 'Floats::zero'}}
13 void f(float); // expected-note 3 {{candidate function}}
14 void g(float);
17 namespace Numbers {
18 using namespace Ints;
19 using namespace Floats;
22 void test() {
23 int i = Ints::zero;
24 Ints::f(i);
26 float f = Floats::zero;
27 Floats::f(f);
29 double n = Numbers::zero; // expected-error {{reference to 'zero' is ambiguous}}
30 Numbers::f(n); // expected-error{{call to 'f' is ambiguous}}
31 Numbers::f(i);
32 Numbers::f(f);
35 namespace Numbers {
36 struct Number { // expected-note 2 {{candidate constructor (the implicit copy constructor) not viable}}
37 #if __cplusplus >= 201103L // C++11 or later
38 // expected-note@-2 2 {{candidate constructor (the implicit move constructor) not viable}}
39 #endif
41 explicit Number(double d) : d(d) {} // expected-note 2{{explicit constructor is not a candidate}}
42 double d;
44 Number zero(0.0f);
45 void g(Number); // expected-note 2{{passing argument to parameter here}}
48 void test2() {
49 Numbers::Number n = Numbers::zero;
50 Numbers::f(n); // expected-error {{no matching function for call to 'f'}}
51 Numbers::g(n);
54 namespace Numbers2 {
55 using Numbers::f;
56 using Numbers::g;
59 void test3() {
60 Numbers::Number n = Numbers::zero;
61 Numbers2::f(n); // expected-error {{no matching function for call to 'f'}}
62 Numbers2::g(n);
64 int i = Ints::zero;
65 Numbers2::f(i);
66 Numbers2::g(i); // expected-error {{no viable conversion from 'int' to 'Number'}}
68 float f = Floats::zero;
69 Numbers2::f(f);
70 Numbers2::g(f); // expected-error {{no viable conversion from 'float' to 'Number'}}
73 namespace inline_ns {
74 int x; // expected-note 2{{found}}
75 inline namespace A {
76 #if __cplusplus <= 199711L // C++03 or earlier
77 // expected-warning@-2 {{inline namespaces are a C++11 feature}}
78 #endif
80 int x; // expected-note 2{{found}}
81 int y; // expected-note 2{{found}}
83 int y; // expected-note 2{{found}}
84 int k1 = x + y; // expected-error 2{{ambiguous}}
85 int k2 = inline_ns::x + inline_ns::y; // expected-error 2{{ambiguous}}