Open Fedr opened 1 month ago
Still crashes in main
: https://gcc.godbolt.org/z/ceexbPaar.
@llvm/issue-subscribers-clang-frontend
Author: Fedor Chelnokov (Fedr)
Confirmed, we should always test w/ clang assertions trunk: https://gcc.godbolt.org/z/Wcc4va3ae
Assertions are more useful when we have them and it is good to know if it is fixed in trunk or not.
Assertion:
clang++: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:16048:
bool clang::Expr::EvaluateAsConstantExpr(clang::Expr::EvalResult&, const clang::ASTContext&, clang::Expr::ConstantExprKind) const:
Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
This is a consequence of having the inner lambda (defined in decltype
) live in an old uninstantiated lambda context, regardless of whether the outer lambda is an instantiation. Therefore, getTemplateInstantiationArgs()
would fail to recover the complete template argument lists while evaluating the type constraint, hence the assert.
Actually, if we managed to give the inner lambda an instantiated parent, we would also fix https://github.com/llvm/llvm-project/issues/97958, where the implicit constexpr
-ness would be properly computed because the inner lambda's parent is no longer dependent.
This program
is accepted by GCC and MSVC, but Clang crashes:
Online demo: https://gcc.godbolt.org/z/z39Gfs5fd
It is a modified example from https://stackoverflow.com/q/77431308/7325599