Boost logo

Boost :

Subject: Re: [boost] [optional] Regression in develop
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-10-30 13:47:10


2017-10-30 13:02 GMT+01:00 Peter Dimov via Boost <boost_at_[hidden]>:

> John Maddock wrote:
>
> I'm mildly against that in Boost.Config: the issue seems to be VC12, ...
>>
>
> No. The suggested addition in https://github.com/boostorg/ty
> pe_traits/pull/52/commits/9779157a787620d163308afa45cb94ef42391b32 is
> wrong; there's nothing type_traits can do about it because instantiating
> the constructor is not an immediate context and not subject to SFINAE.
>
> The problem is in has_trivial_constructor<pair<...>> and is caused by the
> following logic in boost/type_traits/has_trivial_constructor.hpp:
>
> #if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) ||
> defined(BOOST_CLANG) || (defined(__SUNPRO_CC) &&
> defined(BOOST_HAS_TRIVIAL_CONSTRUCTOR))
> #include <boost/type_traits/is_default_constructible.hpp>
> #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible<T>::v
> alue
> #else
>
> which is then used in
>
> template <typename T> struct has_trivial_constructor
> #ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR
> : public integral_constant <bool, ((::boost::is_pod<T>::value ||
> BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)) BOOST_TT_TRIVIAL_CONSTRUCT_FIX)>{};
> #else
>
> That is, the issue only occurs when (a) the compiler is gcc >= 4.9, clang,
> Sun, (b) the compiler has intrinsic support for __has_trivial_constructor,
> (c) instantiating the type's default constructor is a hard error.
>

Is the above a conjunction of (a) and (b) and (c)?

> The latter is the case for pair<deleted-constructor, int> before the
> change in the standard that made its default constructor SFINAE-friendly.
>

This sounds like the trait works fine and it is just implementations of
`std::pair` that are not SFINAE friendly.

> So in practice, this manifests on Travis on gcc 4.9 and clang using
> libstdc++ before 5.
>

You mean version of libstdc++ is before 5?

Regards,
&rzej;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk