https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/72269
This can't be tested right now but will show up once we use the new interpreter in evaluateAsConstantExpression() as well. Pulled out from https://github.com/llvm/llvm-project/pull/70763 >From 074dd59057f1e1e1f2612ce4603a09420ca0a828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Tue, 14 Nov 2023 16:19:34 +0100 Subject: [PATCH] [clang][Interp] Fix classify for glvalues of function type This can't be tested right now but will show up once we use the new interpreter in evaluateAsConstantExpression() as well. --- clang/lib/AST/Interp/ByteCodeExprGen.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index ec9b6bb1408453c..2a75f22e13bed60 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -130,7 +130,13 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>, /// Classifies a type. std::optional<PrimType> classify(const Expr *E) const { - return E->isGLValue() ? PT_Ptr : classify(E->getType()); + if (E->isGLValue()) { + if (E->getType()->isFunctionType()) + return PT_FnPtr; + return PT_Ptr; + } + + return classify(E->getType()); } std::optional<PrimType> classify(QualType Ty) const { return Ctx.classify(Ty); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits