Issue 63837
Summary Concept-constrained non-type template parameter pack in a member template of a class template causes a crash
Labels
Assignees
Reporter jiriklepl
    Simple code to reproduce the bug [https://godbolt.org/z/97PKnxeqP](https://godbolt.org/z/97PKnxeqP):

```cpp
template<class T>
concept IsFoo = true;

template<class>
struct Struct {
 template<IsFoo auto... xs>
    void method() {}
};

template void Struct<void>::method<>();
```

The crash happens on all currently available versions capable of interpreting constraints.

The actual template parameters of the template installation do not matter, I have chosen the simplest ones.

The code is interpreted correctly by the latest [GCC](https://godbolt.org/z/z7McMjzrj) and [MSVC](https://godbolt.org/z/968W13hEq).

---

A very similar code with equivalent semantics that doesn't cause the crash [https://godbolt.org/z/efG5cnqMn](https://godbolt.org/z/efG5cnqMn):

```cpp
template<class T>
concept IsFoo = true;

template<class>
struct Struct {
 template<auto... xs> requires (... && IsFoo<decltype(xs)>)
    void method() {}
};

template void Struct<void>::method<>();
```

The above example could lead to an assumption that the crash is caused by `IsFoo auto` simply appearing in a parameter pack, but that does not seem to be the case as the following simplification of the code, again, is interpreted as expected [https://godbolt.org/z/eYE995q54](https://godbolt.org/z/eYE995q54):

```cpp
template<class T>
concept IsFoo = true;

struct Struct {
    template<IsFoo auto... xs>
    void method() {}
};

template void Struct::method<>();
```

---

The following example demonstrates that bug is not limited to methods [https://godbolt.org/z/GxKd85r7c](https://godbolt.org/z/GxKd85r7c):

```cpp
template<class T>
concept IsFoo = true;

template<class>
struct Struct {
 template<IsFoo auto... xs>
    static constexpr int field = 0;
};

template constexpr int Struct<void>::field<>;
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to