[Bug c++/102419] [11/12 Regression][concepts] [regression] return-type-requirement of "Y<typename T::type>" does not check that T::type actually exists

arthur.j.odwyer at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 21 20:00:34 GMT 2021


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

--- Comment #4 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
> IMHO Clang/MSVC are clearly misbehaving here -- when evaluating the concept-id X<int>, they appear to be substituting {int} into X's constraint-expression instead of into the normal form of X's constraint-expression.

Isn't this situation exactly analogous to `std::void_t`?

  template<class T> using void_t = void;
  template<class T> auto foo(T t) -> void_t<typename T::type>;  // SFINAEs away
  template<class T> auto foo(T t) -> int;  // this is the only viable candidate
  static_assert(std::same_as<decltype(foo(1)), int>);

The language has definitely decided that you can't preemptively fold
`void_t<some-dependent-expression>` down to `void`; I don't think you should be
allowed to preemptively fold `Y<some-dependent-expression>` down to `true`,
either.
I don't know for sure that Clang/MSVC have been authoritatively dubbed
righteous, but their behavior certainly seems, to me, more consistent and
useful than GCC's.


More information about the Gcc-bugs mailing list