https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
--- Comment #6 from Pedro Alves <palves at redhat dot com> --- That kind of makes sense if you look at optional<T> in isolation, but why does it _not_ warn if you remove anything related to B and leave only A? That's what's truly mystifying to me. Even this change makes the warning go away: void func () { Optional<A> maybe_a; - Optional<B> maybe_b; // for some reason, need this here to trigger a + Optional<A> maybe_b; // for some reason, need this here to trigger a // warning in _A_. maybe_a.emplace (); maybe_b.emplace (); // comment out, and the warning disappears. }