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

            Bug ID: 126066
           Summary: ice in lvalue_kind, at cp/tree.cc:285 with -Wall
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Given the following C++ source code, from the llvm clang-tools-extra
testsuite:

void testRequires() {
  if constexpr (requires(int &a) { a = 0; }) {
  }
}

recent g++ trunk does this:

foundBugs $ ../results/bin/g++ -c bug1226.cc
foundBugs $ ../results/bin/g++ -c -Wall bug1226.cc
bug1226.cc: In function ‘void testRequires()’:
bug1226.cc:4:44: internal compiler error: in lvalue_kind, at cp/tree.cc:285
    4 |   if constexpr (requires(int &a) { a = 0; }) {
      |                                            ^
0x2350717 internal_error
       
/home/dcb42/gcc/working/gcc/../../trunk/gcc/diagnostic-global-context.cc:787
0x2359f5b fancy_abort
        /home/dcb42/gcc/working/gcc/../../trunk/gcc/diagnostics/context.cc:1813
0x7ae67c lvalue_kind
        /home/dcb42/gcc/working/gcc/../../trunk/gcc/cp/tree.cc:285
0x7ae9d5 real_lvalue_p
        /home/dcb42/gcc/working/gcc/../../trunk/gcc/cp/tree.cc:366

The compiler is:

$ ~/gcc/results/bin/g++ -v 
Using built-in specs.
COLLECT_GCC=/home/dcb42/gcc/results/bin/g++
COLLECT_LTO_WRAPPER=/home/dcb42/gcc/results.20260701.ubsan/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../trunk/configure
--prefix=/home/dcb42/gcc/results.20260701.ubsan --disable-bootstrap
--disable-doc --disable-multilib --with-build-config=bootstrap-ubsan
--with-pkgversion=cc195f7b11a4061f --enable-checking=yes
--enable-languages=c,c++,fortran
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260701 (experimental) (cc195f7b11a4061f) 
$ 

The bug first appears sometime before g:564af5667f3e0277
at the start of year 2026.

Reply via email to