The following code fails to compile on GCC, but works on MSVC and Clang (godbolt):
#include <concepts>
namespace s {
template<typename T>
struct my_struct {
};
}
template<std::integral T>
struct s::my_struct<T> {};
template<std::floating_point V>
struct s::my_struct<V> {};
int main() {
s::my_struct<int> s{};
s::my_struct<float> s2{};
}
The compile error refers to the second specialization (s::my_struct<V>) as being a redefinition of s::my_struct<T>. As far as I understand this shouldn't be happening as the constraints on them are mutually exclusive, also it works outside the namespace (godbolt). Is this an ambiguity in the standard, or a bug with GCC?