https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97198

            Bug ID: 97198
           Summary: __is_constructible(int[], int) should return true
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com
  Target Milestone: ---

The sample code below returns 0 if it is compiled by GCC HEAD with c++2a mode
but I think that it should return 1.

============ sample code ============
int main()
{
    return __is_constructible(int[], int);
}
============ sample code ============
cf. https://wandbox.org/permlink/nFQtqfxDNJPZRhZt


The C++20 DIS 20.15.4.3 Type properties[meta.unary.prop] p.8 says,

    The predicate condition for a template specialization is_constructible<T,
Args...> shall be satisfied if and only if the following variable definition
would be well-formed for some invented variable t:

    T t(declval<Args>()...);

    ...

cf. https://timsong-cpp.github.io/cppwp/n4861/meta#unary.prop-8


If T = int[] and Args = int, it is well-formed.

============ sample code ============
int main()
{
    using T = int[];
    T t(42);
}
============ sample code ============
cf. https://wandbox.org/permlink/2MhF1PNUbgq7mNAC

So, I think that __is_constructible(int[], int) should return true even though
int[] is imcomplete type. (unless it is a defect of the C++20 DIS)


Related PR:

PR94149 __is_constructible doesn't know about C++20 parenthesized init for
arrays
PR90532 [8/9/10 Regression] is_constructible_v<int[]> and
is_default_constructible_v<int[]> should agree

Reply via email to