https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106838
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> All traits of kind C currently reject T[] and T[1], but should accept them.
Gah, they do in gcc-12, but not trunk, sorry.
But they do reject incomplete unions, which should be accepted.
And traits of kind A incorrectly allow Incomplete[1].
And traits of kind B incorrectly allow Incomplete[].
Here's a testcase:
struct I;
// A.
// "T shall be a complete type, (possibly cv-qualified) void,"
// "or an array of unknown bound."
void kindA()
{
// No incomplete object types.
(void) __is_constructible(I); // { dg-error "incomplete type" "FAILS" }
(void) __is_constructible(I[1]); // { dg-error "incomplete type" "FAILS" }
// Except arrays of unknown bound.
(void) __is_constructible(I[]);
}
// B.
// "remove_all_extents_t<T> shall be a complete type or cv void."
void kindB()
{
// No incomplete types, including arrays.
(void) __is_trivial(I); // { dg-error "incomplete type" }
(void) __is_trivial(I[1]); // { dg-error "incomplete type" }
(void) __is_trivial(I[]); // { dg-error "incomplete type" "FAILS" }
}
union U;
// C.
// "If T is a non-union class type, T shall be a complete type."
void kindC()
{
// No incomplete non-union class types.
(void) __is_empty(I); // { dg-error "incomplete type" }
// But arrays of incomplete type are OK.
(void) __is_empty(I[1]); // { dg-bogus "incomplete type" "FAILS" }
(void) __is_empty(I[]);
// And incomplete unions are OK.
(void) __is_empty(U); // { dg-bogus "incomplete type" "FAILS" }
(void) __is_empty(U[1]); // { dg-bogus "incomplete type" "FAILS" }
(void) __is_empty(U[]);
}
The dg-error lines marked FAIL are incorrectly accepted. The dg-bogus lines are
incorrectly rejected.