Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627406 - gcc 5 fails at valid lambda code
Summary: gcc 5 fails at valid lambda code
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Lowest trivial (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-09 14:42 UTC by Alain B Soucy
Modified: 2017-08-12 19:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alain B Soucy 2017-08-09 14:42:31 UTC
Hi,

I try to compile darktable directly from the sources (no emerge) with
Gcc version 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5). There seem to have a bug according to the developper of Darktable.  

I am not really sure the bug in GCC is of interest since the bug is on a non Gentoo package: darktable extract with git.

Here is a cut-and-paste from the bug report "gcc 5 fails at valid lambda code"
from Linux Mint.  

Note: I have the same bug with the Gentoo-GCC compiler.




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~16.04.4) 5.4.0 20160609

Here is the duplicate of the bug, filled by him in debian bugtracker https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871250

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::<lambda(auto:1, d::h, d::h,
int, d::n() const::p, d::n() const::p)> [with auto:1 = d::n()
const::<lambda()>]’:
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-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=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

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/CREDUCE/main.cpp
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);
}