Clang reports that __is_array(T[0])
is true
#54705
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
__is_array(T[0])
is true
#54705
Clang currently reports that
__is_array(T[0])
is true, which leads tostd::is_array<T[0]>
being true as well.T[0]
is downright ill-formed: http://eel.is/c++draft/dcl.array#1Since it's ill-formed, I guess Clang is technically conforming, however it still leads to code like this surprisingly compiling with Clang:
So it looks like
T[0]
is neither a bounded array nor an unbounded array, but it is an array, which is quite confusing. I would suggest Clang either:T[0]
since it's ill-formed, orT[0]
is an array from its__is_array
builtin (patch provided for this)Also note that Clang will not match a partial specialization like
template <class T, size_t N> struct foo<T[N]> { ... };
when instantiating it withT[0]
, which seems to support the fact that we really don't want to treatT[0]
as an array type.Here's a potential patch that changes
__is_array(T[0])
tofalse
, but I suspect we may want a deeper fix in the compiler.The text was updated successfully, but these errors were encountered: