compiler evolution: get rid of a gcc-4.7 workaround

our minimal compiler requirement is gcc-4.9 since the
transition to Debian/Jessie as reference system.

gcc-4.9 is known to treat SFINAE on private fields properly
This commit is contained in:
Fischlurch 2016-01-05 21:59:42 +01:00
parent c104e28ebf
commit f077c14d47
3 changed files with 4 additions and 34 deletions

View file

@ -117,10 +117,6 @@
#include <type_traits>
#include <utility>
namespace lib {
namespace time{
class Time; // forward declaration for GCC 4.7 workaround
}}
namespace lib {
namespace meta{
@ -242,26 +238,11 @@ namespace meta{
namespace { // helpers to select suitable variant of copy support...
/** workaround for GCC 4.7: need to exclude some types,
* since they raise private access violation during probing.
* Actually, in C++11 such a case should trigger substitution
* failure, not an compilation error */
template<class X>
struct can_use_assignment
: is_copy_assignable<X>
{ };
template<>
struct can_use_assignment<lib::time::Time>
{ static constexpr bool value = false; };
template<class X>
struct supports_only_move
: __and_<is_move_constructible<X>
,__not_<is_copy_constructible<X>>
,__not_<can_use_assignment<X>>
,__not_<is_copy_assignable<X>>
>
{ };
@ -269,7 +250,7 @@ namespace meta{
struct supports_cloning
: __and_<is_move_constructible<X>
,is_copy_constructible<X>
,__not_<can_use_assignment<X>>
,__not_<is_copy_assignable<X>>
>
{ };
@ -277,7 +258,7 @@ namespace meta{
struct supports_copy_and_assignment
: __and_<is_move_constructible<X>
,is_copy_constructible<X>
,can_use_assignment<X>
,is_copy_assignable<X>
>
{ };
}

View file

@ -418,7 +418,7 @@ namespace lib {
using RawType = typename remove_reference<X>::type;
static_assert (meta::isInList<RawType, typename TYPES::List>(),
"Type error: the given variant could never hold the required type");
static_assert (meta::can_use_assignment<RawType>::value, "target type does not support assignment");
static_assert (std::is_copy_assignable<RawType>::value, "target type does not support assignment");
buff<RawType>() = forward<X>(x);
return *this;

View file

@ -241,17 +241,6 @@ namespace test {
}//(End)Test fixture
// GCC 4.7 workaround
// SFINAE does not work properly on private functions
// instead of dropping the template instance, it causes compilation failure
}//now in namespace meta
template<char c>
struct can_use_assignment<test::UnAssignable<c>>
{ static constexpr bool value = false; };
namespace test {