This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80635] std::optional and bogus -Wmaybe-uninitialized warning


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.
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]