Skip to content

Commit 410f130

Browse files
authored
[clang][Interp] Fix classify for glvalues of function type (#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 #70763
1 parent 78702d3 commit 410f130

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
129129

130130
/// Classifies a type.
131131
std::optional<PrimType> classify(const Expr *E) const {
132-
return E->isGLValue() ? PT_Ptr : classify(E->getType());
132+
if (E->isGLValue()) {
133+
if (E->getType()->isFunctionType())
134+
return PT_FnPtr;
135+
return PT_Ptr;
136+
}
137+
138+
return classify(E->getType());
133139
}
134140
std::optional<PrimType> classify(QualType Ty) const {
135141
return Ctx.classify(Ty);

0 commit comments

Comments
 (0)