https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
--- Comment #34 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #15) > I think the following smaller test case independent of libstdc++ captures > the same issue as the bigger test case in comment #4. Again, declaring f() > noexcept avoids the warning (but it's not a solution in general). Zero > initializing A::i first and then setting it to the result of f() also avoids > the warning and seems like more viable solution/workaround until GCC gets > smarter about exceptions. In this example, if you add a useless pointer to t, then GCC doesn't warn: template <class T> struct C { C (): b(), t() { } ~C () { if (b) t.~T (); } void f () { b = true; new (&t) T (); pt = &t; } private: bool b; T * pt; public: union { T t; char x[sizeof (T)]; }; };