Boost logo

Boost :

Subject: Re: [boost] [optional] Regression in develop
From: Peter Dimov (lists_at_[hidden])
Date: 2017-10-30 12:02:45

John Maddock wrote:

> I'm mildly against that in Boost.Config: the issue seems to be VC12, ...

No. The suggested addition in
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) &&
#include <boost/type_traits/is_default_constructible.hpp>
#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_default_constructible<T>::value

which is then used in

template <typename T> struct has_trivial_constructor
   : public integral_constant <bool, ((::boost::is_pod<T>::value ||

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.

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

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at