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

            Bug ID: 126025
           Summary: ICE: tree check: expected constructor, have
                    record_type in dump_expr, at cp/error.cc:2953
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chwang at drw dot com
  Target Milestone: ---

Created attachment 64885
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64885&action=edit
Full output of -freport-bug

The following code causes ICE in GCC master and trunk, but not in GCC 16.1:

Input:

struct A {
    virtual void x() {};
    virtual void y() {};
};
struct B : A {};

template <int>
void dispatch();

void foo() {
    dispatch<(void (B::*)())(&B::y)>();
}

Command:
g++ bug.cpp

Full crash output (with -freport-bug) is in the attachment.

GCC version is:
Using built-in specs.
COLLECT_GCC=/home/chwang/dev/gcc-bin/master/bin/g++
COLLECT_LTO_WRAPPER=/home/chwang/dev/gcc-bin/master/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../../gcc-master/configure --enable-languages=c,c++
--prefix=/home/chwang/dev/gcc-bin/master
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260626 (experimental) (GCC)

Can be reproduced on Godbolt:
https://godbolt.org/z/Wr1exPxWj

The code does not cause ICE if using &B::x instead of &B::y, using class A
instead of B, or without the (void (B::*)()) cast.

Reply via email to