diff --git a/clang/lib/AST/ExprConstantMeta.cpp b/clang/lib/AST/ExprConstantMeta.cpp index 15478d1cfd9f..78d0e8ad2125 100644 --- a/clang/lib/AST/ExprConstantMeta.cpp +++ b/clang/lib/AST/ExprConstantMeta.cpp @@ -1876,7 +1876,7 @@ bool get_ith_template_argument_of(APValue &Result, ASTContext &C, return DiagnoseReflectionKind(Diagnoser, Range, "a template specialization"); APValue R = getNthTemplateArgument(C, TArgs, Evaluator, Sentinel, idx); - if (R.isReflectedDecl()) + if (R.isReflectedDecl() && !isa(R.getReflectedDecl())) R = APValue(APValue::LValueBase{R.getReflectedDecl()}, CharUnits::Zero(), {}, false, false).Lift(QualType{}); return SetAndSucceed(Result, R);