2 // RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify
13 namespace LookupBeforeImport
{
17 int &r
= LookupBeforeImport::f(1);
20 @import namespaces_left
;
21 @import namespaces_right
;
28 int &ir5
= ::global2(1);
29 float &fr1
= N1::f(1.0f
);
30 float &fr2
= N2::f(1.0f
);
31 float &fr3
= global(1.0f
);
32 float &fr4
= ::global2(1.0f
);
33 float &fr5
= LookupBeforeImport::f(1.0f
);
34 double &dr1
= N2::f(1.0);
35 double &dr2
= N3::f(1.0);
36 double &dr3
= global(1.0);
37 double &dr4
= ::global2(1.0);
38 double &dr5
= LookupBeforeImport::f(1.0);
40 struct AddAndReexportBeforeImport::S s
;
41 int k
= AddAndReexportBeforeImport::S
;
44 // Test namespaces merged without a common first declaration.
57 double &fr1
= N5::f(1.0);
58 double &fr2
= N6::f(1.0);
59 double &fr3
= N7::f(1.0);
60 char &cr1
= N5::f('a');
61 char &cr2
= N6::f('b');
64 // Test merging of declarations within namespaces that themselves were
65 // merged without a common first declaration.
66 void testMergedMerged() {
69 int &ir3
= N10::f(17);
72 // Test merging when using anonymous namespaces, which does not
73 // actually perform any merging.
74 void testAnonymousNotMerged() {
75 N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'Foo *' with an rvalue of type 'Foo *'}}
76 N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'Foo *' with an rvalue of type 'Foo *'}}
79 // expected-note@Inputs/namespaces-right.h:60 {{passing argument to parameter here}}
80 // expected-note@Inputs/namespaces-right.h:67 {{passing argument to parameter here}}
81 // expected-note@Inputs/namespaces-left.h:63 {{'N11::(anonymous namespace)::Foo' is not defined, but forward declared here; conversion would be valid if it was derived from 'N11::(anonymous namespace)::Foo'}}
82 // expected-note@Inputs/namespaces-left.h:70 {{'N12::(anonymous namespace)::Foo' is not defined, but forward declared here; conversion would be valid if it was derived from 'N12::(anonymous namespace)::Foo'}}
83 // Test that bringing in one name from an overload set does not hide the rest.
84 void testPartialImportOfOverloadSet() {