When checking for abstract types, don't crash when we have a

FunctionProtoTypeLoc with NULL function parameter types, which can
occur in invalid code. Fixes PR9247 / <rdar://problem/9037911>.

llvm-svn: 126262
This commit is contained in:
Douglas Gregor 2011-02-22 23:21:06 +00:00
parent bb6db56028
commit 385d3fd97d
2 changed files with 13 additions and 0 deletions

View File

@ -2588,6 +2588,9 @@ struct CheckAbstractUsage {
void Check(FunctionProtoTypeLoc TL, Sema::AbstractDiagSelID Sel) {
Visit(TL.getResultLoc(), Sema::AbstractReturnType);
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
if (!TL.getArg(I))
continue;
TypeSourceInfo *TSI = TL.getArg(I)->getTypeSourceInfo();
if (TSI) Visit(TSI->getTypeLoc(), Sema::AbstractParamType);
}

View File

@ -249,3 +249,13 @@ namespace test4 {
static D x; // expected-error {{abstract class}}
};
}
// PR9247: Crash on invalid in clang::Sema::ActOnFinishCXXMemberSpecification
namespace pr9247 {
struct A {
virtual void g(const A& input) = 0;
struct B {
C* f(int foo);
};
};
}