Bug#680521: g++-4.7: ICE while compiling code using <functional>
Package: g++-4.7
Version: 4.7.1-2
Severity: important
g++ ends with ICE on following test code:
===start===
#include <functional>
struct User
{
void run(void *) {}
};
int main()
{
User u;
std::function<void()> p = std::bind(&User::run, &u, nullptr);
}
===end===
$ g++ -std=c++11 -c -O test.cpp
test.cpp: In constructor ‘std::function<_Res(_ArgTypes
....)>::function(_Functor, typename std::enable_if<(!
std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes
....)>::_Useless>::type) [with _Functor = std::_Bind<std::_Mem_fn<void
(User::*)(void*)>(User*, std::nullptr_t)>; _Res = void; _ArgTypes = {};
typename std::enable_if<(! std::is_integral<_Functor>::value),
std::function<_Res(_ArgTypes ...)>::_Useless>::type =
std::function<void()>::_Useless]’:
test.cpp:12:1: internal compiler error: in type_contains_placeholder_1, at
tree.c:2957
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccTlnebC.out file, please attach this to
your bugreport.
Seems related to optimization and nullptr in args. When nullptr is replaced
with (void *)0, gcc compiles the code successfully.
-- System Information:
Debian Release: wheezy/sid
APT prefers testing-proposed-updates
APT policy: (500, 'testing-proposed-updates'), (500, 'testing'), (400, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.3.6+ (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages g++-4.7 depends on:
ii gcc-4.7 4.7.1-2
ii gcc-4.7-base 4.7.1-2
ii libc6 2.13-33
ii libgmp10 2:5.0.5+dfsg-2
ii libmpc2 0.9-4
ii libmpfr4 3.1.0-5
ii libstdc++6-4.7-dev 4.7.1-2
ii zlib1g 1:1.2.7.dfsg-13
g++-4.7 recommends no packages.
Versions of packages g++-4.7 suggests:
ii g++-4.7-multilib 4.7.1-2
pn gcc-4.7-doc <none>
pn libstdc++6-4.7-dbg <none>
-- no debconf information
Reply to: