[Bug c++/90769] Template instantiation recursion when trying to do a conversion template

barry.revzin at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 6 02:35:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90769

--- Comment #1 from Barry Revzin <barry.revzin at gmail dot com> ---
Sorry, more reduced:

#include <type_traits>

enum E {A, B};

struct X
{
  template <E f = B, std::enable_if_t<(f == B), int> = 0>
  constexpr X(int v);

  template <typename OUT, E f = B, std::enable_if_t<(f == B), int> = 0>
  operator OUT() const;
};

#ifdef WORKS
bool operator!=(X const& lhs, int) { 
    return static_cast<int>(lhs) == 0;
}
#else
bool operator==(X const& lhs, int) { 
    return static_cast<int>(lhs) == 0;
}
#endif


More information about the Gcc-bugs mailing list