llvm-project/clang/test/SemaCXX/namespace-alias.cpp

28 lines
812 B
C++
Raw Normal View History

// RUN: clang-cc -fsyntax-only -verify %s
namespace N { };
namespace A = N;
int B; // expected-note {{previous definition is here}}
namespace B = N; // expected-error {{redefinition of 'B' as different kind of symbol}}
namespace C { } // expected-note {{previous definition is here}}
namespace C = N; // expected-error {{redefinition of 'C'}}
int i;
namespace D = i; // expected-error {{expected namespace name}}
namespace E = N::Foo; // expected-error {{expected namespace name}}
namespace F {
namespace A { namespace B { } } // expected-note {{candidate found by name lookup is 'F::A::B'}}
namespace B { } // expected-note {{candidate found by name lookup is 'F::B'}}
using namespace A;
namespace D = B; // expected-error {{reference to 'B' is ambiguous}}
}
2009-03-29 07:49:35 +08:00
namespace G {
namespace B = N;
}