Skip to content

Commit

Permalink
Update is_assignable to be well-defined on MSVC 2013+ (#62)
Browse files Browse the repository at this point in the history
* Adding test case for is_Assignable of non-primitive value to ref

* Add support to let MSVC 2013+ pass new test case

* Moved is_assignable test to appropriate location

Prevents fail on vs2012-
  • Loading branch information
CypherSignal authored and rparolin committed Oct 25, 2016
1 parent 51718cd commit 0788b8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/EASTL/internal/type_pod.h
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ namespace eastl
//
///////////////////////////////////////////////////////////////////////

#if (defined(EA_COMPILER_NO_DECLTYPE) && !EASTL_TYPE_TRAIT_declval_CONFORMANCE) || defined(_MSC_VER) // VS2012 mis-compiles the conforming code below and so must be placed here.
#if (defined(EA_COMPILER_NO_DECLTYPE) && !EASTL_TYPE_TRAIT_declval_CONFORMANCE) || (defined(_MSC_VER) && _MSC_VER <= 1800) // VS2012 mis-compiles the conforming code below and so must be placed here.
#define EASTL_TYPE_TRAIT_is_assignable_CONFORMANCE 0

// It's impossible to do this correctly without declval or some other compiler help.
Expand Down Expand Up @@ -1667,7 +1667,7 @@ namespace eastl
// For a complete type T and given
// template <class U>
// struct test { U u; };
// test<T>::˜test() is not deleted (C++11 "= delete").
// test<T>::˜test() is not deleted (C++11 "= delete").
// T shall be a complete type, (possibly cv-qualified) void, or an array of unknown bound.
//
///////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions test/source/TestTypeTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ int TestTypeTraits()
// These might not succeed unless the implementation is conforming.
static_assert((eastl::is_assignable<Assignable, Assignable>::value == true), "is_assignable failure");
static_assert((eastl::is_assignable<Assignable, Pod1>::value == true), "is_assignable failure");
static_assert((eastl::is_assignable<PodA&, PodA>::value == true), "is_assignable failure");

// These cannot succeed unless the implementation is conforming.
static_assert((eastl::is_assignable<void, void>::value == false), "is_assignable failure");
Expand Down

0 comments on commit 0788b8c

Please sign in to comment.