[Bug c++/71217] [concepts] Incorrect recursive concept evaluation

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 29 10:04:00 GMT 2019


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.0
             Blocks|                            |67491

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Seems to be fixed on current trunk:

template<typename T, typename U> struct is_same {
  static constexpr bool value = false;
};

template<typename T> struct is_same<T, T> {
  static constexpr bool value = true;
};

template <class ... TT> struct Fold;

template <class T>
struct IntFoldCtor
 {
  enum RetType { Ret = false };
 };

template <class T>
concept TestInt = (bool)IntFoldCtor<T>::Ret || is_same<T,int>::value ;

template <TestInt ... TT>
struct IntFoldCtor<Fold<TT...> >
 {
  enum RetType { Ret = true };
 };

static_assert(TestInt<int>);

static_assert(!TestInt<short>); // 0

static_assert(TestInt< Fold<int,int,int> >); // 1

static_assert(!TestInt< Fold<int,int,short> >);  // 0

static_assert(TestInt< Fold<int,Fold<int,int>,int> >); // 0

static_assert(!TestInt< Fold<int,Fold<int,short>,int> >); // 0

static_assert(!TestInt< Fold<int,Fold<int,int>,short> >); // 0


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues


More information about the Gcc-bugs mailing list