// PR c++/113031 // { dg-do compile } template struct variant; template variant<_Types> __variant_cast(_Tp __rhs) { return static_cast&>(__rhs); } template struct _Move_assign_base : _Types { void operator=(_Move_assign_base __rhs) { __variant_cast<_Types>(__rhs); } }; template struct variant : _Move_assign_base<_Types> { void emplace() { variant __tmp; *this = __tmp; } }; struct _Undefined_class { struct _Nocopy_types { void (_Undefined_class::*_M_member_pointer)(); }; struct function : _Nocopy_types { struct optional { void test03() { variant v; v.emplace(); } }; }; };