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

            Bug ID: 102419
           Summary: [concepts] [regression] return-type-requirement of
                    "Y<typename T::type>" does not check that T::type
                    actually exists
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/GWjYYnrnM
template<class, class> concept Y = true;
template<class T> concept X = requires {
    { 1 } -> Y<typename T::type>;
};
static_assert(!X<int>);


<source>:8:15: error: static assertion failed
    8 | static_assert(!X<int>);
      |               ^~~~~~~

Clang and MSVC both appear to have the correct behavior -- or what I believe to
be the consistent/useful/majority behavior, anyway -- which is that since
T::type doesn't exist, the concept shouldn't be satisfied.

This seems to be a regression; according to Godbolt, GCC 10.3 had the correct
behavior but GCC 11.1 lost it. 

I wonder if #92268 could be related somehow, since it seems to be something
like the inverse issue (nonexistent nested type causing a hard error in 10.x),
and it was marked fixed presumably somewhere in the 11.x timeframe.

Reply via email to