This commit is contained in:
Simon Brand
2017-10-25 09:27:10 +01:00
parent c6bb208387
commit 207146e1e6
2 changed files with 12 additions and 9 deletions

View File

@ -29,17 +29,9 @@
#endif
#if (defined(__GNUC__) && __GNUC__ == 5 && __GNUC_MINOR__ <= 4)
#define TL_OPTIONAL_GCC54 1
#else
#define TL_OPTIONAL_GCC54 2
#define TL_OPTIONAL_GCC54
#endif
template <int> struct TC;
TC<__GNUC__> debug_1;
TC<__GNUC_MINOR__> debug_2;
TC<TL_OPTIONAL_GCC54> debug_3;
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9)
#define TL_OPTIONAL_NO_CONSTRR
#endif

View File

@ -11,6 +11,8 @@
constexpr int get_int(int) { return 42; }
TL_OPTIONAL_11_CONSTEXPR tl::optional<int> get_opt_int(int) { return 42; }
template <int> struct TC;
// What is Clang Format up to?!
TEST_CASE("Monadic operations", "[monadic]") {
SECTION("map") { // lhs is empty
@ -122,8 +124,17 @@ TEST_CASE("Monadic operations", "[monadic]") {
}
SECTION("map constexpr") {
#if !defined(TL_OPTIONAL_GCC54)
constexpr int i = 0;
#else
constexpr int i = 1;
#endif
#if !defined(_MSC_VER) && !defined(TL_OPTIONAL_GCC49) && \
!defined(TL_OPTIONAL_GCC54)
TC<i>{};
// test each overload in turn
constexpr tl::optional<int> o16 = 42;
constexpr auto o16r = o16.map(get_int);