https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112591

--- Comment #7 from Tomasz KamiƄski <tkaminsk at gcc dot gnu.org> ---
The current C++17 behavior makes are non-conforming,
as for following example:
```
struct X {
  constexpr X() {}
  constexpr X(X&&) {}
  ~X() {}
};
std::variant<X> v{std::in_place_index<0>};
```
The variable v is has static initialization in C++20,
and dynamic in C++17, while the used constructor is constexpr
since C++17.

You can see that __static_initialization_and_destruction_0() in C++17,
contains call to variant constructor for v (https://godbolt.org/z/W3czoj1Tc).
  • [Bug libstdc++/112591] variant ... tkaminsk at gcc dot gnu.org via Gcc-bugs

Reply via email to