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

            Bug ID: 113591
           Summary: FAIL: g++.dg/cpp0x/lambda/lambda-ice15.C
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
  Target Milestone: ---

See PR 67846.  The original PR highlighted an ICE, and we do not ICE on
Windows, but we don't error out either.  We can achieve the Linux behavior with
-fno-ms-extensions on Windows, and the Windows behavior with -fms-extensions on
Linux.

If we assume that the behavior is an intended MS Extension, then it would be
good to have the testsuite verify that the error happens only with those
disabled and doesn't happen with them enabled.  If it's not an intended
extension, then this PR could stand to document the needed fix.  N


This is the part of the testcase that fails to error out on Windows:

```
class A {
  void foo() {
    [=] { return foo; };
  }
};
```

On Linux:
$ g++ -c a.cc -fms-extensions
$ g++ -c a.cc
a.cc: In lambda function:
a.cc:3:30: error: cannot convert 'A::foo' from type 'void (A::)()' to type
'void (A::*)()'
    3 |                 [=] { return foo; };
      |                              ^~~
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/tmp/gcc/rt/linux14/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-nls --disable-multilib
--prefix=/tmp/rt/linux14 --enable-languages=all
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240116 (experimental) (GCC)


On Windows:
$ x86_64-w64-mingw32-g++ -c a.cc
$ x86_64-w64-mingw32-g++ -c a.cc -fno-ms-extensions
a.cc: In lambda function:
a.cc:3:30: error: cannot convert 'A::foo' from type 'void (A::)()' to type
'void (A::*)()'
    3 |                 [=] { return foo; };
      |                              ^~~
$ x86_64-w64-mingw32-g++ -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/tmp/gcc/rt/mingw14/bin/../libexec/gcc/x86_64-w64-mingw32/14.0.1/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --disable-multilib --disable-nls
--target=x86_64-w64-mingw32 --prefix=/tmp/rt/mingw14
--with-sysroot=/tmp/rt/mingw14
--enable-languages=c,ada,c++,d,fortran,lto,m2,objc,obj-c++,rust
Thread model: win32
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240120 (experimental) (GCC)

Reply via email to