https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90243
Bug ID: 90243 Summary: diagnostic notes that belong to a suppressed error about an uninitialized variable in a constexpr function are still shown Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kretz at kde dot org Target Milestone: --- Test case (https://godbolt.org/z/34KB20): struct Z { int y; }; template <class T> constexpr Z f(const T *data) { Z z; __builtin_memcpy(&z, data, sizeof(z)); return z; } constexpr Z g(const char *data) { return f(data); } This prints: <source>: In instantiation of 'constexpr Z f(const T*) [with T = char]': <source>:12:48: required from here <source>:1:8: note: 'struct Z' has no user-provided default constructor <source>:2:7: note: and the implicitly-defined constructor does not initialize 'int Z::y' If f is not a template, `Z z;` is an error and the notes explain the error. But when f is a template the error is suppressed (seems correct). However the notes that explain the error are still shown. Whether the notes are shown should use the same condition as the error.