Skip to content

Commit

Permalink
[clang][Interp] Fix classify for glvalues of function type (#72269)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tbaederr committed Nov 14, 2023
1 parent 78702d3 commit 410f130
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clang/lib/AST/Interp/ByteCodeExprGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,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);
Expand Down

0 comments on commit 410f130

Please sign in to comment.