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

            Bug ID: 128975
           Summary: [c++26 reflection] gcc trunk and gcc 16: ``template
                    <class T> concept dtor = requires { ^^T::~T; };``
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: songb432 at gmail dot com
  Target Milestone: ---

Link:

``
template <class T> concept dtor = requires { ^^T::~T; };

static_assert(dtor<int>); // error in Clang (reflection): type 'int' cannot be
used prior to '::' because it has no members
                          // ok in GCC 16. ICE in GCC trunk (date: 20261123)

static_assert(dtor<int[2]>); // error in Clang (reflection).
                             // ok in GCC 16. ICE in GCC trunk (date: 20261123)

static_assert(dtor<void>); // ok in GCC 16. ICE in GCC trunk (date: 20261123)

struct S { };
static_assert(dtor<S>); // error in Clang (reflection): taking the address of a
destructor.
                        // ok in GCC 16. ICE in GCC trunk (date: 20261123)
``


Every assertion fails in Clang (reflection).
Every assertion passes in GCC 16.
Every assertion triggers ICE in GCC trunk:
<source>:1:51: internal compiler error: in tsubst_expr, at cp/pt.cc:21962
    1 | template <class T> concept dtor = requires { ^^T::~T; };
      |                                                   ^~
/cefs/11/1136a9a9fcd7704dbb5ea104_arm_gcc-trunk-20261123/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/17.0.0/cc1plus
-quiet -iprefix
/cefs/11/1136a9a9fcd7704dbb5ea104_arm_gcc-trunk-20261123/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/17.0.0/
-isysroot
/cefs/11/1136a9a9fcd7704dbb5ea104_arm_gcc-trunk-20261123/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -mfloat-abi=hard -mfpu=neon -mtls-dialect=gnu -mthumb
-mlibarch=armv7-a+simd -march=armv7-a+simd -g -std=c++26
-fdiagnostics-color=always -fno-verbose-asm -freflection -o /app/output.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to