https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106029
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-06-20 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- IIRC the problem is that std::optional's copy ctor is defaulted, and in such cases GCC doesn't show where a defaulted ctor is first needed. It just shows the location as the location of the class itself. There might already be a bug report about this.