gcc 5 fails at valid lambda code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linux Mint |
New
|
Undecided
|
Unassigned |
Bug Description
Hello
The bug was found at an attempt of compilation of the mater branch of darktable from git. Roman Lebedev, the author of the code, asked to file a bug in OS bugtracker.
Linux Mint 18.2 Mate x64.
gcc (Ubuntu 5.4.0-6ubuntu1~
Here is the duplicate of the bug, filled by him in debian bugtracker https:/
Package: g++-5
Version: 5.4.1-11
Severity: normal
Tags: upstream
The test-case is creduced.
Only the GCC5 fails, gcc-4.9, 6 and 7 do not.
clang-3.9, 4, 5, trunk is also fine with that code.
$ g++-7 -std=c++14 -c main.cpp
$ g++-6 -std=c++14 -c main.cpp
$ g++-5 -std=c++14 -c main.cpp
main.cpp: In instantiation of ‘d::n() const::
int, d::n() const::p, d::n() const::p)> [with auto:1 = d::n()
const::
main.cpp:26:28: required from here
main.cpp:23:11: error: ‘e’ is not captured
if (e < e)
^
main.cpp:23:11: note: ‘const int& e’ declared here
- -- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'unstable-debug'), (1, 'experimental-
Architecture: amd64 (x86_64)
Kernel: Linux 4.11.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/
Versions of packages g++-5 depends on:
ii gcc-5 5.4.1-11
ii gcc-5-base 5.4.1-11
ii libc6 2.24-14
ii libgmp10 2:6.1.2+dfsg-1
ii libisl15 0.18-1
ii libmpc3 1.0.3-1+b2
ii libmpfr4 3.1.5-1
ii libstdc++-5-dev 5.4.1-11
ii zlib1g 1:1.2.8.dfsg-5
g++-5 recommends no packages.
Versions of packages g++-5 suggests:
pn g++-5-multilib <none>
pn gcc-5-doc <none>
pn libstdc++6-5-dbg <none>
- -- no debconf information
*** /home/lebedevri
using a = int;
using c = int;
struct d {
struct {
a e;
} f;
enum h { i, j };
struct k {
int l[0][0];
};
int m(k *, c *, a, int, int *) const;
void n() const;
};
void d::n() const {
c *o;
k *info;
struct p {
} g;
p b;
int errcnt;
const int e = f.e;
auto pass = [&](auto, h, h, int, p, p) {
if (e < e)
errcnt = m(0, o, 0, 0, info->l[0]);
};
pass([] {}, i, j, 0, g, b);
}