Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1363,7 +1363,7 @@ template bool ByteCodeExprGen::VisitCXXThrowExpr(const CXXThrowExpr *E) { - if (!this->discard(E->getSubExpr())) + if (E->getSubExpr() && !this->discard(E->getSubExpr())) return false; return this->emitInvalid(E); Index: clang/test/AST/Interp/invalid.cpp =================================================================== --- clang/test/AST/Interp/invalid.cpp +++ clang/test/AST/Interp/invalid.cpp @@ -23,6 +23,17 @@ // ref-note {{subexpression not valid in a constant expression}} return 0; } + + constexpr int NoSubExpr() { // ref-error {{never produces a constant expression}} \ + // expected-error {{never produces a constant expression}} + throw; // ref-note 2{{subexpression not valid}} \ + // expected-note 2{{subexpression not valid}} + return 0; + } + static_assert(NoSubExpr() == 0, ""); // ref-error {{not an integral constant expression}} \ + // ref-note {{in call to}} \ + // expected-error {{not an integral constant expression}} \ + // expected-note {{in call to}} } namespace Asm {