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
6 int zero
= 0; // expected-note {{candidate found by name lookup is 'Ints::zero'}}
7 void f(int); // expected-note 3 {{candidate function}}
12 float zero
= 0.0f
; // expected-note {{candidate found by name lookup is 'Floats::zero'}}
13 void f(float); // expected-note 3 {{candidate function}}
19 using namespace Floats
;
26 float f
= Floats::zero
;
29 double n
= Numbers::zero
; // expected-error {{reference to 'zero' is ambiguous}}
30 Numbers::f(n
); // expected-error{{call to 'f' is ambiguous}}
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}}
41 explicit Number(double d
) : d(d
) {} // expected-note 2{{explicit constructor is not a candidate}}
45 void g(Number
); // expected-note 2{{passing argument to parameter here}}
49 Numbers::Number n
= Numbers::zero
;
50 Numbers::f(n
); // expected-error {{no matching function for call to 'f'}}
60 Numbers::Number n
= Numbers::zero
;
61 Numbers2::f(n
); // expected-error {{no matching function for call to 'f'}}
66 Numbers2::g(i
); // expected-error {{no viable conversion from 'int' to 'Number'}}
68 float f
= Floats::zero
;
70 Numbers2::g(f
); // expected-error {{no viable conversion from 'float' to 'Number'}}
74 int x
; // expected-note 2{{found}}
76 #if __cplusplus <= 199711L // C++03 or earlier
77 // expected-warning@-2 {{inline namespaces are a C++11 feature}}
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}}