llvm-project
40 строк · 1.2 Кб
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3class A {};4
5namespace B {6namespace A {} // expected-note{{namespace '::B::A' defined here}} \7// expected-note 2{{namespace 'B::A' defined here}}
8using namespace A ;9}
10
11namespace C {} // expected-note{{namespace 'C' defined here}}12
13namespace D {14
15class C {16
17using namespace B ; // expected-error{{not allowed}}18};19
20namespace B {}21
22using namespace C ;23using namespace B::A ; // expected-error{{no namespace named 'A' in namespace 'D::B'; did you mean '::B::A'?}}24using namespace ::B::A ;25using namespace ::D::F ; // expected-error{{expected namespace name}}26using namespace ::D::C ; // expected-error{{no namespace named 'C' in namespace 'D'; did you mean simply 'C'?}}27}
28
29using namespace ! ; // expected-error{{expected namespace name}}30using namespace A ; // expected-error{{no namespace named 'A'; did you mean 'B::A'?}}31using namespace ::A // expected-error{{no namespace named 'A' in the global namespace; did you mean 'B::A'?}} \32// expected-error{{expected ';' after namespace name}}
33B ;34
35void test_nslookup() {36int B;37class C;38using namespace B;39using namespace C;40}
41