public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97198] New: __is_constructible(int[], int) should return true
@ 2020-09-25  5:29 kariya_mitsuru at hotmail dot com
  2020-09-25  8:48 ` [Bug c++/97198] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2020-09-25  5:29 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-03-14 17:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25  5:29 [Bug c++/97198] New: __is_constructible(int[], int) should return true kariya_mitsuru at hotmail dot com
2020-09-25  8:48 ` [Bug c++/97198] " redi at gcc dot gnu.org
2020-09-25 12:53 ` mpolacek at gcc dot gnu.org
2020-09-25 17:26 ` mpolacek at gcc dot gnu.org
2020-09-25 18:49 ` redi at gcc dot gnu.org
2020-09-25 19:06 ` mpolacek at gcc dot gnu.org
2020-10-05 11:02 ` redi at gcc dot gnu.org
2022-03-12  7:48 ` lichray at gmail dot com
2022-03-12 10:10 ` redi at gcc dot gnu.org
2022-03-14 11:51 ` redi at gcc dot gnu.org
2022-03-14 17:02 ` lichray at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).