http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46134

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-02 
09:58:26 UTC ---
I was recently playing with the following trick to remove the static_assert
from the body of the constexpr constructors:

struct _Undefined;
typedef typename std::conditional<is_pointer<_Dp>::value, _Undefined,
_Dp>::type __uninitialized_deleter;

constexpr
unique_ptr() : _M_t(pointer(), __uninitialized_deleter()) { }

If _Dp is a pointer this tries to create a temporary of incomplete type, which
is ill-formed and gives an error about "uninitialized_deleter".  Otherwise, it
value-initializes the deleter.

Reply via email to