xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/namespaces.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // PR6596
4f4a2713aSLionel Sambuc namespace g { enum { o = 0 }; }
5f4a2713aSLionel Sambuc 
foo()6f4a2713aSLionel Sambuc void foo() {
7f4a2713aSLionel Sambuc   namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
8f4a2713aSLionel Sambuc }
9f4a2713aSLionel Sambuc 
10f4a2713aSLionel Sambuc // PR14085
11f4a2713aSLionel Sambuc namespace PR14085 {}
12f4a2713aSLionel Sambuc namespace = PR14085; // expected-error {{expected identifier}}
13*0a6a1f1dSLionel Sambuc 
14*0a6a1f1dSLionel Sambuc struct namespace_nested_in_record {
15*0a6a1f1dSLionel Sambuc   int k = ({namespace {}}); // expected-error {{statement expression not allowed at file scope}}
16*0a6a1f1dSLionel Sambuc };
17