diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp --- a/clang/lib/AST/Interp/Interp.cpp +++ b/clang/lib/AST/Interp/Interp.cpp @@ -239,7 +239,8 @@ if (!S.checkingPotentialConstantExpression()) { const SourceInfo &Loc = S.Current->getSource(OpPC); - S.FFDiag(Loc, diag::note_constexpr_access_uninit) << AK << false; + S.FFDiag(Loc, diag::note_constexpr_access_uninit) + << AK << /*uninitialized=*/true; } return false; } diff --git a/clang/test/AST/Interp/constexpr-nqueens.cpp b/clang/test/AST/Interp/constexpr-nqueens.cpp --- a/clang/test/AST/Interp/constexpr-nqueens.cpp +++ b/clang/test/AST/Interp/constexpr-nqueens.cpp @@ -18,7 +18,7 @@ Failed(Failed) {} constexpr Board addQueen(int Row, int Col) const { return Board(State | ((uint64_t)Row << (Col * 4))); // ref-note {{read of uninitialized object}} \ - // expected-note {{read of object outside its lifetime}} + // expected-note {{read of uninitialized object}} } constexpr int getQueenRow(int Col) const { return (State >> (Col * 4)) & 0xf; diff --git a/clang/test/AST/Interp/cxx20.cpp b/clang/test/AST/Interp/cxx20.cpp --- a/clang/test/AST/Interp/cxx20.cpp +++ b/clang/test/AST/Interp/cxx20.cpp @@ -59,8 +59,7 @@ constexpr int unInitLocal() { int a; return a; // ref-note {{read of uninitialized object}} \ - // expected-note {{read of object outside its lifetime}} - // FIXME: ^^^ Wrong diagnostic. + // expected-note {{read of uninitialized object}} } static_assert(unInitLocal() == 0, ""); // ref-error {{not an integral constant expression}} \ // ref-note {{in call to 'unInitLocal()'}} \ @@ -76,7 +75,7 @@ constexpr int initializedLocal2() { int a[2]; - return *a; // expected-note {{read of object outside its lifetime}} \ + return *a; // expected-note {{read of uninitialized object is not allowed in a constant expression}} \ // ref-note {{read of uninitialized object is not allowed in a constant expression}} } static_assert(initializedLocal2() == 20); // expected-error {{not an integral constant expression}} \ @@ -89,7 +88,7 @@ constexpr int initializedLocal3() { Int i; return i.a; // ref-note {{read of uninitialized object is not allowed in a constant expression}} \ - // expected-note {{read of object outside its lifetime}} + // expected-note {{read of uninitialized object}} } static_assert(initializedLocal3() == 20); // expected-error {{not an integral constant expression}} \ // expected-note {{in call to}} \ @@ -315,7 +314,7 @@ static_assert(Final{1, 2, 3}.c == 3, ""); // OK static_assert(Final{1, 2, 3}.a == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of object outside its lifetime}} \ + // expected-note {{read of uninitialized object}} \ // ref-error {{not an integral constant expression}} \ // ref-note {{read of uninitialized object}} @@ -337,7 +336,7 @@ static_assert(Final2{1, 2, 3}.c == 3, ""); // OK static_assert(Final2{1, 2, 3}.b == 2, ""); // OK static_assert(Final2{1, 2, 3}.a == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of object outside its lifetime}} \ + // expected-note {{read of uninitialized object}} \ // ref-error {{not an integral constant expression}} \ // ref-note {{read of uninitialized object}} @@ -356,7 +355,7 @@ static_assert(Final3{1, 2, 3}.c == 3, ""); // OK static_assert(Final3{1, 2, 3}.b == 2, ""); // OK static_assert(Final3{1, 2, 3}.a == 0, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of object outside its lifetime}} \ + // expected-note {{read of uninitialized object}} \ // ref-error {{not an integral constant expression}} \ // ref-note {{read of uninitialized object}} }; diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp --- a/clang/test/AST/Interp/literals.cpp +++ b/clang/test/AST/Interp/literals.cpp @@ -467,10 +467,10 @@ T a; if constexpr (Inc) ++a; // ref-note 2{{increment of uninitialized}} \ - // expected-note 2{{increment of object outside its lifetime}} + // expected-note 2{{increment of uninitialized}} else --a; // ref-note 2{{decrement of uninitialized}} \ - // expected-note 2{{decrement of object outside its lifetime}} + // expected-note 2{{decrement of uninitialized}} return 1; } static_assert(uninit(), ""); // ref-error {{not an integral constant expression}} \ diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -404,7 +404,7 @@ static_assert(D.Val == 0, ""); // ref-error {{not an integral constant expression}} \ // ref-note {{initializer of 'D' is not a constant expression}} \ // expected-error {{not an integral constant expression}} \ - // expected-note {{read of object outside its lifetime}} + // expected-note {{read of uninitialized object}} #endif struct AnotherBase { @@ -467,7 +467,7 @@ constexpr A a{10}; // expected-error {{must be initialized by a constant expression}} static_assert(a.m == 10, ""); static_assert(a.f == 10, ""); // expected-error {{not an integral constant expression}} \ - // expected-note {{read of object outside its lifetime}} + // expected-note {{read of uninitialized object}} class Foo { public: