Index: clang/lib/AST/Interp/InterpFrame.cpp =================================================================== --- clang/lib/AST/Interp/InterpFrame.cpp +++ clang/lib/AST/Interp/InterpFrame.cpp @@ -213,6 +213,11 @@ } SourceInfo InterpFrame::getSource(CodePtr PC) const { + // Implicitly created functions don't have any code we could point at, + // so return the call site. + if (Func && Func->getDecl()->isImplicit() && Caller) + return Caller->getSource(RetPC); + return S.getSource(Func, PC); } Index: clang/test/AST/Interp/cxx20.cpp =================================================================== --- clang/test/AST/Interp/cxx20.cpp +++ clang/test/AST/Interp/cxx20.cpp @@ -623,3 +623,26 @@ constexpr C c = {1,2,3}; static_assert(c.a == 1 && c.b == 2 && c.c == 3); } + +namespace ImplicitFunction { + struct A { + int a; // ref-note {{subobject declared here}} + }; + + constexpr int callMe() { + A a; + A b{12}; + + /// The operator= call here will fail and the diagnostics should be fine. + b = a; // ref-note {{subobject 'a' is not initialized}} \ + // ref-note {{in call to}} \ + // expected-note {{read of uninitialized object}} \ + // expected-note {{in call to}} + + return 1; + } + static_assert(callMe() == 1, ""); // ref-error {{not an integral constant expression}} \ + // ref-note {{in call to 'callMe()'}} \ + // expected-error {{not an integral constant expression}} \ + // expected-note {{in call to 'callMe()'}} +}