llvm-capstone/clang/test/SemaCXX/pr18284-crash-on-invalid.cpp
Nico Weber 7607fce112 Don't mark record decls invalid when one of its methods is invalid, PR18284.
Without this patch, record decls with invalid out-of-line method delcs would
sometimes be marked invalid, but not always.  With this patch, they are
consistently never marked invalid.

(The code to do this was added in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100809/033154.html
, but the test from that revision is still passing.)

As far as I can tell, this was the only place where a class was marked invalid
after its definition was complete.

llvm-svn: 197848
2013-12-21 00:49:51 +00:00

25 lines
432 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
// Don't crash (PR18284).
namespace n1 {
class A { };
class C { A a; };
A::RunTest() {} // expected-error {{C++ requires a type specifier for all declarations}}
void f() {
new C;
}
} // namespace n1
namespace n2 {
class A { };
class C : public A { };
A::RunTest() {} // expected-error {{C++ requires a type specifier for all declarations}}
void f() {
new C;
}
} // namespace n2