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

            Bug ID: 119379
           Summary: [15 regression] ICE on CTAD for alias template with
                    type constraint
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmingyi01 at gmail dot com
  Target Milestone: ---

The following C++20 code causes an ICE in trunk.
```c++
template <class, class>
concept C = true;

template <class T, class U>
struct pair {
    constexpr pair(T, U) {}
};

template <class T>
struct S {
    template <C<T> U>
    using P = pair<T, U>;
};

S<int>::P p{42, ""};
```

Output:
```
<source>:15:19: internal compiler error: same canonical type node for different
types 'S<int>::P<U>' and 'pair<int, U>'
   15 | S<int>::P p{42, ""};
      |                   ^
0x2913db5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x292add6 internal_error(char const*, ...)
        ???:0
0xdb0fd5 comptypes(tree_node*, tree_node*, int)
        ???:0
0xd0d882 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int, tree_node*)
        ???:0
0xbc423a cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
        ???:0
0xcee07b c_parse_file()
        ???:0
0xe4f519 c_common_parse_file()
        ???:0
```

The latest Clang and MSVC accept this code. (Compiler Explorer's MSVC is not up
to date.)

See https://compiler-explorer.com/z/PT73bh3qd.

Reply via email to