blob: 1d781fbdcf6449342f98a00c815d250eb1dafec3 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregorf780abc2008-12-30 03:27:21 +00002
3class A {};
4
5namespace B {
Kaelyn Uhrain2d4d7fd2012-02-15 22:14:18 +00006 namespace A {} // expected-note{{namespace '::B::A' defined here}}
Douglas Gregorf780abc2008-12-30 03:27:21 +00007 using namespace A ;
8}
9
10namespace C {}
11
12namespace D {
13
14 class C {
15
Douglas Gregor9cfbe482009-06-20 00:51:54 +000016 using namespace B ; // expected-error{{not allowed}}
Douglas Gregorf780abc2008-12-30 03:27:21 +000017 };
18
19 namespace B {}
20
21 using namespace C ;
Kaelyn Uhrain2d4d7fd2012-02-15 22:14:18 +000022 using namespace B::A ; // expected-error{{no namespace named 'A' in namespace 'D::B'; did you mean '::B::A'?}}
Douglas Gregorf780abc2008-12-30 03:27:21 +000023 using namespace ::B::A ;
24 using namespace ::D::C ; // expected-error{{expected namespace name}}
25}
26
27using namespace ! ; // expected-error{{expected namespace name}}
28using namespace A ; // expected-error{{expected namespace name}}
Douglas Gregor4b2d3f72009-02-26 21:00:50 +000029using namespace ::A // expected-error{{expected namespace name}} \
30 // expected-error{{expected ';' after namespace name}}
31 B ;
Douglas Gregorf780abc2008-12-30 03:27:21 +000032
Douglas Gregoreb11cd02009-01-14 22:20:51 +000033void test_nslookup() {
34 int B;
35 class C;
36 using namespace B;
37 using namespace C;
38}