Commit 8ab69e43 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r243196:

------------------------------------------------------------------------
r243196 | davide | 2015-07-24 18:19:32 -0700 (Fri, 24 Jul 2015) | 6 lines

[SemaTemplate] Detect instantiation of unparsed exceptions.

This fixes the clang crash reported in PR24000.

Differential Revision:	http://reviews.llvm.org/D11341

------------------------------------------------------------------------

llvm-svn: 243433
parent cade945d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -161,7 +161,13 @@ Sema::ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT) {
  else
    InstantiateExceptionSpec(Loc, SourceDecl);

  return SourceDecl->getType()->castAs<FunctionProtoType>();
  const FunctionProtoType *Proto =
    SourceDecl->getType()->castAs<FunctionProtoType>();
  if (Proto->getExceptionSpecType() == clang::EST_Unparsed) {
    Diag(Loc, diag::err_exception_spec_not_parsed);
    Proto = nullptr;
  }
  return Proto;
}

void
+17 −0
Original line number Diff line number Diff line
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -fcxx-exceptions -fexceptions %s

struct A {
  virtual ~A();
};
template <class>
struct B {};
struct C {
  template <typename>
  struct D {
    ~D() throw();
  };
  struct E : A {
    D<int> d; //expected-error{{exception specification is not available until end of class definition}}
  };
  B<int> b; //expected-note{{in instantiation of template class 'B<int>' requested here}}
};