// Test namespaces merged without a common first declaration.
namespaceN5{
char&f(char);
}
namespaceN10{
int&f(int);
}
voidtestMerged(){
int&ir1=N5::f(17);
int&ir2=N6::f(17);
int&ir3=N7::f(17);
double&fr1=N5::f(1.0);
double&fr2=N6::f(1.0);
double&fr3=N7::f(1.0);
char&cr1=N5::f('a');
char&cr2=N6::f('b');
}
// Test merging of declarations within namespaces that themselves were
// merged without a common first declaration.
voidtestMergedMerged(){
int&ir1=N8::f(17);
int&ir2=N9::f(17);
int&ir3=N10::f(17);
}
// Test merging when using anonymous namespaces, which does not
// actually perform any merging.
voidtestAnonymousNotMerged(){
N11::consumeFoo(N11::getFoo());// expected-error{{cannot initialize a parameter of type 'N11::<anonymous>::Foo *' with an rvalue of type 'N11::<anonymous>::Foo *'}}
N12::consumeFoo(N12::getFoo());// expected-error{{cannot initialize a parameter of type 'N12::<anonymous>::Foo *' with an rvalue of type 'N12::<anonymous>::Foo *'}}