xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/pr18284-crash-on-invalid.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*0a6a1f1dSLionel Sambuc // Don't crash (PR18284).
3*0a6a1f1dSLionel Sambuc 
4*0a6a1f1dSLionel Sambuc namespace n1 {
5*0a6a1f1dSLionel Sambuc class A { };
6*0a6a1f1dSLionel Sambuc class C { A a; };
7*0a6a1f1dSLionel Sambuc 
RunTest()8*0a6a1f1dSLionel Sambuc A::RunTest() {} // expected-error {{C++ requires a type specifier for all declarations}}
9*0a6a1f1dSLionel Sambuc 
f()10*0a6a1f1dSLionel Sambuc void f() {
11*0a6a1f1dSLionel Sambuc   new C;
12*0a6a1f1dSLionel Sambuc }
13*0a6a1f1dSLionel Sambuc } // namespace n1
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc namespace n2 {
16*0a6a1f1dSLionel Sambuc class A { };
17*0a6a1f1dSLionel Sambuc class C : public A { };
18*0a6a1f1dSLionel Sambuc 
RunTest()19*0a6a1f1dSLionel Sambuc A::RunTest() {} // expected-error {{C++ requires a type specifier for all declarations}}
20*0a6a1f1dSLionel Sambuc 
f()21*0a6a1f1dSLionel Sambuc void f() {
22*0a6a1f1dSLionel Sambuc   new C;
23*0a6a1f1dSLionel Sambuc }
24*0a6a1f1dSLionel Sambuc } // namespace n2
25