return;
}
- if (!NoexceptExpr->isValueDependent())
- NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, nullptr,
- diag::err_noexcept_needs_constant_expression,
- /*AllowFold*/ false).get();
+ if (!NoexceptExpr->isValueDependent()) {
+ ExprResult Result = VerifyIntegerConstantExpression(
+ NoexceptExpr, nullptr, diag::err_noexcept_needs_constant_expression,
+ /*AllowFold*/ false);
+ if (Result.isInvalid()) {
+ ESI.Type = EST_BasicNoexcept;
+ return;
+ }
+ NoexceptExpr = Result.get();
+ }
ESI.NoexceptExpr = NoexceptExpr;
}
return;
f<0>(); // expected-note{{in instantiation of function template specialization}}
}
}
+
+namespace FuncTmplNoexceptError {
+ int a = 0;
+ // expected-error@+1{{argument to noexcept specifier must be a constant expression}}
+ template <class T> T f() noexcept(a++){ return {};}
+ void g(){
+ f<int>();
+ }
+};