[Bug c++/71794] Std::array as an incomplete type in nested name specifier.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 7 11:43:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71794
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libstdc++ |c++
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is nothing to do with libstdc++, the problem is that you've using int
rather than std::size_t
using size_t = decltype(sizeof(0));
template<typename T, size_t N>
struct array
{
T data[N];
};
template<typename T, int N>
struct MyContainer
{
T data[N];
};
template <typename T>
struct B;
template <typename T>
T foo()
{
return B<T>::bar();
}
template <typename T, int N>
struct B<array<T, N>>
{
static array<T, N> bar()
{
return array<T, N>();
}
};
template <typename T, int N>
struct B<MyContainer<T, N>>
{
static MyContainer<T, N> bar()
{
return MyContainer<T, N>();
}
};
int main()
{
foo<array<float, 4>>(); // incomplete type
foo<MyContainer<float, 4>>();
}
foo<array<float, 4>> returns B<array<float, (size_t)4>> which doesn't match
your partial specialization of B<array<float, (int)4>>
Clang accepts this, but G++ and EDG reject it for the same reason.
More information about the Gcc-bugs
mailing list