Package: g++-7 Version: 7.2.0-16 Followup-For: Bug #882855 Dear Maintainer,
here is some more information. g++-5 doesn't return an internal compiler error, but g++-6 and later are. I've also tested with g++ from the gcc-snapshot package, it returns the same error. Here is the transcript: --------- g++-5 -std=c++11 test.cpp /tmp/ccPhbMC2.o: In function `s<float>::count()': test.cpp:(.text._ZN1sIfE5countEv[_ZN1sIfE5countEv]+0xd): undefined reference to `rand()' collect2: error: ld returned 1 exit status ~ $ g++-6 test.cpp test.cpp: In instantiation of ‘f(s<v>)::<lambda(int&)> [with v = float]’: test.cpp:14:16: required from ‘struct f(s<v>) [with v = float]::<lambda(int&)>’ test.cpp:20:5: required from ‘int f(s<v>) [with v = float]’ test.cpp:24:24: required from here test.cpp:16:33: internal compiler error: in maybe_undo_parenthesized_ref, at cp/semantics.c:1694 for(int y = 0, yend = (x); y < yend; ++y) ^ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions. ~ $ g++-7 test.cpp test.cpp: In instantiation of ‘f(s<v>)::<lambda(int&)> [with v = float]’: test.cpp:14:16: required from ‘struct f(s<v>) [with v = float]::<lambda(int&)>’ test.cpp:14:10: required from ‘int f(s<v>) [with v = float]’ test.cpp:24:24: required from here test.cpp:16:24: internal compiler error: in maybe_undo_parenthesized_ref, at cp/semantics.c:1705 for(int y = 0, yend = (x); y < yend; ++y) ^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. ~ $ /usr/lib/gcc-snapshot/bin/g++ test.cpp test.cpp: In function 'int f(s<v>)': test.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ test.cpp: In instantiation of 'int f(s<v>) [with v = float]': test.cpp:24:24: required from here test.cpp:16:24: internal compiler error: in maybe_undo_parenthesized_ref, at cp/semantics.c:1738 for(int y = 0, yend = (x); y < yend; ++y) ^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions. -------- Hope it helps, David -- System Information: Debian Release: buster/sid APT prefers unstable APT policy: (900, 'unstable'), (500, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages g++-7 depends on: ii gcc-7 7.2.0-16 ii gcc-7-base 7.2.0-16 ii libc6 2.25-2 ii libgmp10 2:6.1.2+dfsg-1.1 ii libisl15 0.18-1 ii libmpc3 1.0.3-2 ii libmpfr4 3.1.6-1 ii libstdc++-7-dev 7.2.0-16 ii zlib1g 1:1.2.8.dfsg-5 g++-7 recommends no packages. Versions of packages g++-7 suggests: ii g++-7-multilib 7.2.0-16 pn gcc-7-doc <none> pn libstdc++6-7-dbg <none> -- no debconf information