Bug#882855: g++-7: internal compiler error: in maybe_undo_parenthesized_ref on for initialization list
Package: g++-7
Version: 7.2.0-16
Severity: important
Dear Maintainer,
The following C++ program, when compiled with g++, returns an internal compiler error.
--------
int rand();
template<typename T>
struct s
{
int count() { return rand(); }
};
template<typename v>
int f(s<v> a)
{
int const x = a.count();
int r = 0;
auto l = [&](int& r)
{
for(int y = 0, yend = (x); y < yend; ++y)
{
r += y;
}
};
l(r);
}
template int f(s<float>);
int main()
{
}
--------
g++ test.cpp returns:
--------
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.
--------
Thanks!
-- 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.24-17
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
Reply to: