Index: include/clang/AST/ExprCXX.h =================================================================== --- include/clang/AST/ExprCXX.h +++ include/clang/AST/ExprCXX.h @@ -3340,13 +3340,15 @@ public: CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, - SourceLocation Keyword, SourceLocation RParen) + bool IsConstexpr, SourceLocation Keyword, + SourceLocation RParen) : Expr(CXXNoexceptExprClass, Ty, VK_RValue, OK_Ordinary, /*TypeDependent*/false, - /*ValueDependent*/Val == CT_Dependent, + /*ValueDependent*/Val == CT_Dependent && !IsConstexpr, Val == CT_Dependent || Operand->isInstantiationDependent(), Operand->containsUnexpandedParameterPack()), - Value(Val == CT_Cannot), Operand(Operand), Range(Keyword, RParen) + Value(Val == CT_Cannot || IsConstexpr), + Operand(Operand), Range(Keyword, RParen) { } CXXNoexceptExpr(EmptyShell Empty) Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -5799,8 +5799,10 @@ } CanThrowResult CanThrow = canThrow(Operand); + bool IsConstexpr = Operand->isCXX11ConstantExpr(Context); return new (Context) - CXXNoexceptExpr(Context.BoolTy, Operand, CanThrow, KeyLoc, RParen); + CXXNoexceptExpr(Context.BoolTy, Operand, CanThrow, IsConstexpr, + KeyLoc, RParen); } ExprResult Sema::ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation, Index: test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp =================================================================== --- test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -23,6 +23,7 @@ void nothrowattr() __attribute__((nothrow)); void noexcept_true() noexcept; void noexcept_false() noexcept(false); +constexpr int constexprspec() { return 3; } void call() { N(nospec()); @@ -32,6 +33,7 @@ P(nothrowattr()); P(noexcept_true()); N(noexcept_false()); + P(constexprspec()); } void (*pnospec)();