Browse Source

GCC 4.6 compatibility: no delegating constructors in Math::BoolVector.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
0e34eeda58
  1. 7
      src/Math/BoolVector.h
  2. 4
      src/Math/Test/BoolVectorTest.cpp

7
src/Math/BoolVector.h

@ -20,6 +20,7 @@
*/
#include <Utility/Debug.h>
#include <corradeCompatibility.h>
#include "Types.h"
@ -75,7 +76,13 @@ template<std::size_t size> class BoolVector {
#ifdef DOXYGEN_GENERATING_OUTPUT
inline explicit BoolVector(T value);
#else
#ifndef CORRADE_GCC46_COMPATIBILITY
template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> inline constexpr explicit BoolVector(T value): BoolVector(typename Implementation::GenerateSequence<DataSize>::Type(), value ? FullSegmentMask : 0) {}
#else
template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> inline explicit BoolVector(T value) {
*this = BoolVector(typename Implementation::GenerateSequence<DataSize>::Type(), value ? FullSegmentMask : 0);
}
#endif
#endif
/** @brief Copy constructor */

4
src/Math/Test/BoolVectorTest.cpp

@ -111,9 +111,11 @@ void BoolVectorTest::constExpressions() {
constexpr BoolVector19 b(0xa5, 0x5f, 0x07);
CORRADE_COMPARE(b, BoolVector19(0xa5, 0x5f, 0x07));
/* One-value constructor */
/* One-value constructor, not constexpr under GCC < 4.7 */
#ifndef CORRADE_GCC46_COMPATIBILITY
constexpr BoolVector19 c(true);
CORRADE_COMPARE(c, BoolVector19(0xff, 0xff, 0x07));
#endif
/* Copy constructor */
constexpr BoolVector19 d(b);

Loading…
Cancel
Save