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

            Bug ID: 121596
           Summary: An ICE caused by returning lambada with requires.
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hym608 at outlook dot com
  Target Milestone: ---

Created attachment 62146
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62146&action=edit
The file saved by command `-save-temps`

The Bug 92402(still unsolved and can be confirmed by modern GCC)'s shown us a
bug with returning a lamada with decltype. However, this is not simply a bug of
decltype.

My code is here:

```
template<typename T>
bool test() {
    return requires {
        []() -> void requires requires {
            ({ auto&& [a] = T(); });
        } {};
    };
}
```

`gcc -v` returns:
```
Using built-in specs.
COLLECT_GCC=C:\TDM-GCC-64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/15.2.0/lto-wrapper.exe
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-w64-mingw32
Configured with: ../configure
--prefix=/R/winlibs_staging_ucrt64/inst_gcc-15.2.0/share/gcc
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
--enable-offload-targets=nvptx-none --with-pkgversion='MinGW-W64
x86_64-ucrt-posix-seh, built by Brecht Sanders, r1' --with-tune=generic
--enable-checking=release --enable-threads=posix --disable-sjlj-exceptions
--disable-libunwind-exceptions --disable-serial-configure --disable-bootstrap
--enable-host-shared --enable-plugin --disable-default-ssp --disable-rpath
--disable-libstdcxx-debug --disable-version-specific-runtime-libs
--disable-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++
--disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry
--disable-multilib --enable-ld --enable-libquadmath --enable-libada
--enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string
--enable-libgomp --enable-graphite --enable-mingw-wildcard
--enable-libstdcxx-time --enable-libstdcxx-pch
--with-mpc=/c/Prog/winlibs_staging_ucrt/custombuilt64
--with-mpfr=/c/Prog/winlibs_staging_ucrt/custombuilt64
--with-gmp=/c/Prog/winlibs_staging_ucrt/custombuilt64
--with-isl=/c/Prog/winlibs_staging_ucrt/custombuilt64
--disable-libstdcxx-backtrace --enable-install-libiberty --enable-__cxa_atexit
--without-included-gettext --with-diagnostics-color=auto
--enable-clocale=generic --enable-libgdiagnostics --with-libiconv
--with-system-zlib
--with-build-sysroot=/R/winlibs_staging_ucrt64/gcc-15.2.0/build_mingw/mingw-w64
CFLAGS='-I/c/Prog/winlibs_staging_ucrt/custombuilt64/include/libdl-win32  
-march=nocona -msahf -mtune=generic -O2 -Wno-error=format'
CXXFLAGS='-Wno-int-conversion  -march=nocona -msahf -mtune=generic -O2'
LDFLAGS='-pthread -Wl,--no-insert-timestamp -Wl,--dynamicbase
-Wl,--high-entropy-va -Wl,--nxcompat -Wl,--tsaware'
LD=/c/Prog/winlibs_staging_ucrt/custombuilt64/share/binutils/bin/ld.exe
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders,
r1)
```

And this is the ICE:
```
g++ gcc 1.cpp -o 1.exe -std=c++20
1.cpp: In function 'bool test()':
1.cpp:5:25: internal compiler error: in cp_parser_decomposition_declaration, at
cp/parser.cc:16813
    5 |             ({ auto&& [a] = T(); });
      |                         ^
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
```

Reply via email to