[Bug c++/108563] New: [concepts] ICE (segfault) when requiring sizeof(variable_tempalate_v<type>)

ldalessandro at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 26 21:43:25 GMT 2023


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

            Bug ID: 108563
           Summary: [concepts] ICE (segfault) when requiring
                    sizeof(variable_tempalate_v<type>)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

The following valid code causes an ICE (segfault)

    template <class T>
    struct foo {
        static constexpr int value = 0;
    };

    template <class T>
    inline constexpr int foo_v = foo<T>::value;

    static_assert(requires {  sizeof(foo_v<int>); });

Workaround is to use `foo<int>::value` instead of the variable template.

Live example: https://godbolt.org/z/s7szdEdeP


More information about the Gcc-bugs mailing list