зеркало из https://github.com/microsoft/clang.git
The expression in a noexcept exception-specification is a
constant-expression, and, therefore, an unevaluated operand. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
17e37c7959
Коммит
3617e198aa
|
@ -2239,6 +2239,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
|
|||
}
|
||||
Expr *NoexceptExpr = 0;
|
||||
if (Expr *OldNoexceptExpr = Proto->getNoexceptExpr()) {
|
||||
EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
|
||||
ExprResult E = SemaRef.SubstExpr(OldNoexceptExpr, TemplateArgs);
|
||||
if (E.isUsable())
|
||||
NoexceptExpr = E.take();
|
||||
|
|
|
@ -58,3 +58,16 @@ namespace noex {
|
|||
void g2(bool b) noexcept(b); // expected-error {{argument to noexcept specifier must be a constant expression}}
|
||||
|
||||
}
|
||||
|
||||
namespace noexcept_unevaluated {
|
||||
template<typename T> void f(T) {
|
||||
T* x = 1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void g(T x) noexcept((f(x), sizeof(T) == 4)) { }
|
||||
|
||||
void h() {
|
||||
g(1);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче