https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113272
Bug ID: 113272
Summary: Wrong specialization of class template selected
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This program
#include <concepts>
template <auto>
struct A;
template <auto p>
requires std::same_as<decltype(p), const int*>
struct A<p> : std::false_type {};
template <auto p>
requires std::same_as<decltype(p), int*>
struct A<p> : std::true_type {};
int x = 0;
static_assert( A<&x>::value ); ///< try to comment this line
static_assert( !A<(const int *)&x>::value ); ///< GCC fails here
is accepted by Clang and MSVC, but GCC erroneously evaluates the last line.
Online demo: https://godbolt.org/z/5Pqx6TG3W
But if one comments the previous static_assert, then it starts working.