Don't call isIntegerConstantExpr on value dependent Expr

...as it causes Clang to fail with

> Assertion failed: (!isValueDependent() && "Expression evaluator can't be called on a dependent expression."), function isIntegerConstantExpr, file .../llvm/llvm-project/clang/lib/AST/ExprConstant.cpp, line 15487.

Change-Id: I335f7610955c30a5c102bfb3b8aa6441a30dd247
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108241
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-12-23 18:44:47 +01:00
parent 473ca9b753
commit 68a3c364f7
2 changed files with 5 additions and 2 deletions

View File

@ -131,7 +131,7 @@ public:
{
break;
}
if (e2->isIntegerConstantExpr(compiler.getASTContext()))
if (!e2->isValueDependent() && e2->isIntegerConstantExpr(compiler.getASTContext()))
{
break;
}

View File

@ -11,8 +11,9 @@
#include "rtl/ustring.hxx"
OUString f(sal_Unicode c, int n)
template <sal_Unicode C> OUString f(sal_Unicode c, int n)
{
OUString s0(C);
OUString s1(c);
// expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
OUString s2('a');
@ -23,6 +24,8 @@ OUString f(sal_Unicode c, int n)
OUString s4 = s4lit;
switch (n)
{
case 0:
return s0;
case 1:
return s1;
case 2: