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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue May  7 22:46:39 2019
New Revision: 270987

URL: https://gcc.gnu.org/viewcvs?rev=270987&root=gcc&view=rev
Log:
PR libstdc++/89102 implement new common_type rules (P0435R1, P0548R1)

This change ensures that std::common_type<> is a complete type (LWG
2408), and that std::common_type<T>, std::common_type<cv T1, cv T2>, and
std::common_type<T1, T2, R...> will use program-defined specializations
for std::common_type<T1, T2> (LWG 2465).

The implementation of common_type<T1, T2, R...> is changed to use
void_t, and the specializations for duration and time_point are modified
to also use void_t instead of depending on implementation details of
common_type.

        PR libstdc++/89102
        * doc/xml/manual/intro.xml: Document DR 2408 and 2465 changes.
        * include/std/chrono (__duration_common_type_wrapper): Replace with ...
        (__duration_common_type): New helper.
        (common_type<chrono::duration<R1, P2>, chrono::duration<R2, P2>>): Use
        __duration_common_type.
        (__timepoint_common_type_wrapper): Replace with ...
        (__timepoint_common_type): New helper.
        (common_type<chrono::time_point<C, D2>, chrono::time_point<C, D2>>):
        Use __time_point_common_type.
        * include/std/type_traits (common_type<>): Define, as per LWG 2408.
        (__common_type_impl): If either argument is transformed by decay,
        use the common_type of the decayed types.
        (__common_type_impl<_Tp, _Up, _Tp, _Up>): If the types are already
        decayed, use __do_common_type_impl to get the common_type.
        (common_type<_Tp>): Use common_type<_Tp, _Tp>.
        (__do_member_type_wrapper, __member_type_wrapper)
        (__expanded_common_type_wrapper): Remove.
        (__common_type_pack, __common_type_fold): New helpers.
        (common_type<_Tp, _Up, _Vp...>): Use new helpers instead of
        __member_type_wrapper and __expanded_common_type_wrapper.
        * testsuite/20_util/common_type/requirements/explicit_instantiation.cc:
        Test zero-length template argument list.
        * testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc:
        Test single argument cases and argument types that should decay.
        * testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc:
        Adjust expected error.
        * testsuite/20_util/duration/literals/range_neg.cc: Use zero for
        dg-error lineno.
        * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
        * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
        * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/doc/xml/manual/intro.xml
    trunk/libstdc++-v3/include/std/chrono
    trunk/libstdc++-v3/include/std/type_traits
   
trunk/libstdc++-v3/testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc
    trunk/libstdc++-v3/testsuite/20_util/duration/literals/range_neg.cc
    trunk/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
    trunk/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
    trunk/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc

Reply via email to