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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Ted Lyngmo from comment #4)
> Andrew: The reduced example you provided is not interpreted the same way as
> what I used when I wrote the report. I think they fail for different
> reasons. Possibly at different stages. I went through the language standards
> (11 and above) when I wrote the report but it was only with gcc 14+ that
> there was an issue.

Oh it is even more subtle. Note my other reduced testcase is also broken and
should be fixed too.

Here is a new reduced testcase:
```
template <typename _Tp, typename _Up>
  inline constexpr bool is_same_v1 = __is_same_as(_Tp, _Up);
template<class = void>
void foo() {
    using type = decltype([](){});
    type i1;
    type i2;
    // This passes:
    static_assert(__is_same_as(type, type));
    // BUT this does not pass
    static_assert(is_same_v1<type, type>);
};

int main() {    
    foo();
}
```

The direct use of __is_same_as (__is_same but didn't exist in GCC 9) works in
every version (9+) that supports C++2a (C++20) and lambda in decltype but going
through a template variable does not in GCC 14+.

Reply via email to