// { dg-require-effective-target c++17 } // { dg-options "-Og -Wall" } // { dg-skip-if "requires hosted libstdc++ for memory shared_ptr" { ! hostedlib } } #include #include struct A { A (int a) : a {a} {} const std::shared_ptr x; int a; }; class B { public: B (const std::optional & a) : a {a} { } public: const std::optional a; }; int main () { B b {std::nullopt}; }