Skip to content

Commit

Permalink
Fix crash on 'value_of' with fields, functions, etc.
Browse files Browse the repository at this point in the history
Closes issue #84.
  • Loading branch information
katzdm committed Aug 8, 2024
1 parent 7d7f850 commit b28f899
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/Sema/Metafunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,9 @@ bool value_of(APValue &Result, Sema &S, EvalFn Evaluator, DiagFn Diagnoser,
} else if (auto *TPOD = dyn_cast<TemplateParamObjectDecl>(Decl)) {
Value = TPOD->getValue();
QT = TPOD->getType();
} else {
return Diagnoser(Range.getBegin(), diag::metafn_cannot_query_property)
<< 2 << DescriptionOf(RV) << Range;
}

QualType ValueTy = S.ComputeResultType(QT, Value);
Expand Down

0 comments on commit b28f899

Please sign in to comment.