xref: /llvm-project/clang/test/Parser/namespaces.cpp (revision 02e764487fa4a8e22e5ef3e8b2ab9c8361454b69)
1*02e76448SDavid Majnemer // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
205cfc295SDouglas Gregor 
305cfc295SDouglas Gregor // PR6596
405cfc295SDouglas Gregor namespace g { enum { o = 0 }; }
505cfc295SDouglas Gregor 
foo()605cfc295SDouglas Gregor void foo() {
705cfc295SDouglas Gregor   namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
805cfc295SDouglas Gregor }
9729f1e2aSNico Weber 
10729f1e2aSNico Weber // PR14085
11729f1e2aSNico Weber namespace PR14085 {}
12729f1e2aSNico Weber namespace = PR14085; // expected-error {{expected identifier}}
13*02e76448SDavid Majnemer 
14*02e76448SDavid Majnemer struct namespace_nested_in_record {
15*02e76448SDavid Majnemer   int k = ({namespace {}}); // expected-error {{statement expression not allowed at file scope}}
16*02e76448SDavid Majnemer };
17