diff --git a/clang/lib/AST/ByteCode/InterpFrame.cpp b/clang/lib/AST/ByteCode/InterpFrame.cpp index 1a6e271c78d6f..e4bd4a6ba7656 100644 --- a/clang/lib/AST/ByteCode/InterpFrame.cpp +++ b/clang/lib/AST/ByteCode/InterpFrame.cpp @@ -107,7 +107,18 @@ void InterpFrame::destroy(unsigned Idx) { template static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty) { - V.toAPValue(ASTCtx).printPretty(OS, ASTCtx, Ty); + if constexpr (std::is_same_v) { + if (Ty->isPointerOrReferenceType()) + V.toAPValue(ASTCtx).printPretty(OS, ASTCtx, Ty); + else { + if (std::optional RValue = V.toRValue(ASTCtx, Ty)) + RValue->printPretty(OS, ASTCtx, Ty); + else + OS << "..."; + } + } else { + V.toAPValue(ASTCtx).printPretty(OS, ASTCtx, Ty); + } } static bool shouldSkipInBacktrace(const Function *F) { diff --git a/clang/test/AST/ByteCode/constexpr-frame-describe.cpp b/clang/test/AST/ByteCode/constexpr-frame-describe.cpp index d875d8730b7d6..1b19a7af0663b 100644 --- a/clang/test/AST/ByteCode/constexpr-frame-describe.cpp +++ b/clang/test/AST/ByteCode/constexpr-frame-describe.cpp @@ -79,8 +79,7 @@ static_assert(bar.fail1()); // both-error {{constant expression}} \ static_assert(bar.fail2()); // both-error {{constant expression}} \ // both-note {{in call to 'bar.fail2()'}} static_assert(bar.fail3(3, 4UL, bar, &bar)); // both-error {{constant expression}} \ - // expected-note {{in call to 'bar.fail3, const Bar *>(3, 4, &bar, &bar)'}} \ - // ref-note {{in call to 'bar.fail3, const Bar *>(3, 4, {}, &bar)'}} + // both-note {{in call to 'bar.fail3, const Bar *>(3, 4, {}, &bar)'}}