https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104470
Bug ID: 104470 Summary: internal compiler error: Segmentation fault compiling std::variant with -std=c++20 Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: serpent7776 at gmail dot com Target Milestone: --- Created attachment 52396 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52396&action=edit Preprocessed source I encountered an internal compiler error while compiling the following code in c++20 mode (no other flags are needed): #include <variant> template <typename T> struct Foo { T value; }; template <typename T> struct Bar { T value; }; template <typename T> using V = std::variant<Foo<T>, Bar<T>>; int main() { V e = Foo("a"); } When I switch to c++17 mode compiler does not crash. I tested it on g++ 10.3.0 on FreeBSD 12.3-RELEASE-p1, but I can also reproduce it on trunk version here https://godbolt.org/z/vn5Ws14Ma Full error: # g++10 -std=c++20 ice.ii In file included from ice.cpp:1: /usr/local/lib/gcc10/include/c++/variant: In substitution of 'template<class ... _Types> template<class _Tp, class> using __accepted_type = std::variant<_Types>::__to_type<__accepted_index<_Tp> > [with _Tp = _Tp&&; <template-parameter-2-2> = typename std::enable_if<std::variant<Foo<T>, Bar<T> >::__not_self<_Tp&&>, void>::type; _Types = {Foo<T>, Bar<T>}]': ice.cpp:20:15: required from here /usr/local/lib/gcc10/include/c++/variant:1335:36: internal compiler error: Segmentation fault 1335 | using __accepted_type = __to_type<__accepted_index<_Tp>>; | ^~~~~~~~~~~~~~~~~~~~ libbacktrace could not find executable to open