#include <concepts>
template <class = void>
struct Foo {
template <std::same_as<void> Param>
friend struct Bar;
};
template struct Foo<>;
template <std::same_as<void> Param>
struct Bar {
};
Clang 16 and further reject this program with the following error message:
<source>:11:11: error: type constraint differs in template redeclaration
template <std::same_as<void> Param>
^
<source>:5:15: note: previous template declaration is here
template <std::same_as<void> Param>
^
1 error generated.
Compiler returned: 1
Clang versions 11-15 work as expected, though.
Compiler Explorer link: https://godbolt.org/z/erGavP1za.
GCC also had a similar bug at some point: 93467.