[Bug c++/104470] internal compiler error: Segmentation fault compiling std::variant with -std=c++20

max.kanold@nu-cost.com gcc-bugzilla@gcc.gnu.org
Fri Apr 22 11:57:36 GMT 2022


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

Max <max.kanold@nu-cost.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |max.kanold@nu-cost.com

--- Comment #4 from Max <max.kanold@nu-cost.com> ---
Not sure whether it helps, but here is a version of the same ICE without the
struct having a member, see https://godbolt.org/z/4xjbcToxj

================================
#include <variant>

template<typename T>
struct A {};

template<typename T>
using Var = std::variant<A<T>>;

int main() {
    auto var = Var{};
}
================================

Here the compiler can clearly not deduce the type, so this is invalid code.
Adding the type leads to valid code which is compiled as expected.


More information about the Gcc-bugs mailing list