Index: clang/lib/AST/Interp/ByteCodeExprGen.h =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.h +++ clang/lib/AST/Interp/ByteCodeExprGen.h @@ -101,6 +101,7 @@ bool VisitCXXThrowExpr(const CXXThrowExpr *E); bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E); bool VisitSourceLocExpr(const SourceLocExpr *E); + bool VisitCXXNoexceptExpr(const CXXNoexceptExpr *E); protected: bool visitExpr(const Expr *E) override; Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1191,6 +1191,16 @@ return true; } +template +bool ByteCodeExprGen::VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) { + assert(E->getType()->isBooleanType()); + const Expr *Operand = E->getOperand(); + + if (DiscardResult) + return this->discard(Operand); + return this->emitConstBool(E->getValue(), E); +} + template bool ByteCodeExprGen::discard(const Expr *E) { if (E->containsErrors()) return false; Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -1033,3 +1033,14 @@ int array[(long)(char*)0]; // ref-warning {{variable length array folded to constant array}} \ // expected-warning {{variable length array folded to constant array}} } + +namespace NE { + constexpr int foo() noexcept { + return 1; + } + static_assert(noexcept(foo()), ""); + constexpr int foo2() { + return 1; + } + static_assert(!noexcept(foo2()), ""); +}