public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113272] New: Wrong specialization of class template selected
@ 2024-01-08 13:23 fchelnokov at gmail dot com
  2024-01-08 15:52 ` [Bug c++/113272] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fchelnokov at gmail dot com @ 2024-01-08 13:23 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-10  0:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 13:23 [Bug c++/113272] New: Wrong specialization of class template selected fchelnokov at gmail dot com
2024-01-08 15:52 ` [Bug c++/113272] " pinskia at gcc dot gnu.org
2024-01-09 14:41 ` mpolacek at gcc dot gnu.org
2024-01-09 14:56 ` fchelnokov at gmail dot com
2024-01-10  0:12 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).