Prevent assertion in loplugin:cppunitassertequals

> clang++: /home/sberg/github.com/llvm/llvm-project/clang/lib/AST/ExprConstant.cpp:22171: bool clang::Expr::isCXX11ConstantExpr(const ASTContext &, APValue *) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.

as seen at engine/sc/qa/unit/ucalc_pivottable.cxx:269

>     CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected data range.",
>                            static_cast<SCCOL>(FieldCount - 1), nCol2);

since 94299df72efeddb3d5af31396f5008300d66a90d "sc: Use #SPILL! error if the
pivot table output is blocked"

Signed-off-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Change-Id: I83f7949a7458ce030c13e94e2d9682ae080cc763
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1895
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit c3dec06e55716011a69d7b47163747007e05d905)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211834
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Stephan Bergmann
2026-10-06 09:55:14 +02:00
committed by Xisco Fauli
parent e7bbe1600d
commit 63301fc8d2
@@ -232,7 +232,7 @@ Expr const * stripConstructor(Expr const * expr) {
bool CppunitAssertEquals::isCompileTimeConstant(Expr const * expr)
{
if (expr->isCXX11ConstantExpr(compiler.getASTContext()))
if (!expr->isValueDependent() && expr->isCXX11ConstantExpr(compiler.getASTContext()))
return true;
// is string literal ?
expr = expr->IgnoreParenImpCasts();