This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH, RFC] Implement new C++ intrinsics __is_assignable and __is_constructible.


On 12 May 2017 at 14:15, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:
> On 12 May 2017 at 14:06, Daniel Krügler <daniel.kruegler@gmail.com> wrote:
>> Your description sounds remotely similar to me to the current problem
>> of __is_trivially_constructible intrinsic, which seems to instantiate
>> the copy constructor definition albeit it (IMO) shouldn't:
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654
>>
>> Could there be a similar cause?
>
>
> Seems quite plausible to me. I would be happy to fix that bug in the
> same go, but I'm a bit
> lost as to what exactly causes the problem. constructible_expr in method.c does
> build_special_member_call for the constructor and the destructor, so
> perhaps there
> are some flags that could make it behave.

Well, now that Jason pointed out that cp_unevaluated_operand is the
trick, here's a new
patch that fixes that bug and passes the full testsuite on Linux-x64.

2017-05-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

    c-family/

    Implement new C++ intrinsics __is_assignable and __is_constructible.
    * c-common.c (__is_assignable, __is_constructible): New.
    * c-common.h (RID_IS_ASSIGNABLE, RID_IS_CONSTRUCTIBLE): Likewise.

    cp/

    PR c++/80654
    PR c++/80682
    Implement new C++ intrinsics __is_assignable and __is_constructible.
    * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
    (is_xible): New.
    * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
    CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
    * method.c (constructible_expr): Set cp_unevaluated.
    (is_xible_helper): New.
    (is_trivially_xible): Adjust.
    (is_xible): New.
    * parser.c (cp_parser_primary_expression): Handle
    RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
    (cp_parser_trait_expr): Likewise.
    * semantics.c (trait_expr_value): Handle
    CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.

    testsuite/

    * g++.dg/ext/80654.C: New.

    libstdc++-v3/

    Implement new C++ intrinsics __is_assignable and __is_constructible.
    * include/std/type_traits (__do_is_static_castable_impl): Remove.
    (__is_static_castable_impl, __is_static_castable_safe): Likewise.
    (__is_static_castable, __do_is_direct_constructible_impl): Likewise.
    (__is_direct_constructible_impl): Likewise.
    (__is_direct_constructible_new_safe): Likewise.
    (__is_base_to_derived_ref, __is_lvalue_to_rvalue_ref): Likewise.
    (__is_direct_constructible_ref_cast): Likewise.
    (__is_direct_constructible_new, __is_direct_constructible): Likewise.
    (__do_is_nary_constructible_impl): Likewise.
    (__is_nary_constructible_impl, __is_nary_constructible): Likewise.
    (__is_constructible_impl): Likewise.
    (is_constructible): Call the intrinsic.
    (__is_assignable_helper): Remove.
    (is_assignable): Call the intrinsic.
    (is_trivially_constructible): Likewise.
    (is_trivially_assignable): Likewise.
    (testsuite/20_util/declval/requirements/1_neg.cc): Adjust.
    (testsuite/20_util/make_signed/requirements/typedefs_neg.cc): Likewise.
    (testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc):
    Likewise.

Attachment: is_constructible.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]