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

            Bug ID: 112633
           Summary: ICE in parser GCC 13+ (including 14) around type
                    aliases
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hanicka at hanicka dot net
  Target Milestone: ---

Tested on GCC 14.0.0 20231119 (on Compiler-Explorer) and it's giving me ICE,
also on all 13.x versions (not 12.x)

```c++
template <class> constexpr bool dependent_true = true;

template <bool> struct empty_type { }; // something like enable_if

template <bool B> using empty_type_t = typename empty_type<B>::type; 

struct wrapper {
    using type = void;
};

template <class...> using all = wrapper;

template <class... Conditions>
using constraints = typename all<Conditions...>::type;

template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> 
void calculate() { };
```

I don't even need to instantiate `calculate` function.

It gives me this error:

<source>: In substitution of 'template<class ... Conditions> using constraints
= typename all<Conditions ...>::type [with Conditions = {typename
empty_type<dependent_true<T> >::type}]':
<source>:16:66:   required from here
   16 | template <typename T, constraints<empty_type_t<dependent_true<T>>> =
nullptr>
      |                                                                  ^
<source>:14:7: internal compiler error: Segmentation fault
   14 | using constraints = typename all<Conditions...>::type;
      |       ^~~~~~~~~~~
0x26a742e internal_error(char const*, ...)
        ???:0
0xd276f0 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd1b8f3 instantiate_template(tree_node*, tree_node*, int)
        ???:0
0xd285ea tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd35ed6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0xd6996f finish_template_type(tree_node*, tree_node*, int)
        ???:0
0xcf6a49 c_parse_file()
        ???:0
0xe38e79 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to