blob: 9f575477f6b405a21f5fdeed0cc1d9b461d3c59e [file] [log] [blame]
// PR tree-optimization/80635
// { dg-do compile { target c++17 } }
// { dg-options "-O2 -Wmaybe-uninitialized" }
#include <optional>
extern int get ();
extern void set (int);
struct A
{
A () : m (get ()) {}
~A () { set (m); } // { dg-bogus "may be used uninitialized in this function" }
int m;
};
struct B
{
B ();
~B ();
};
void func ()
{
std::optional<A> maybe_a;
std::optional<B> maybe_b;
maybe_a.emplace ();
maybe_b.emplace ();
}