gcc 4.7.3-1ubuntu10 c++11 bogus errors (reduced, not reproducible upstream)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
Fix Released
|
Medium
|
|||
gcc-4.7 (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
This code:
namespace NS {
struct A
{
static void foo(int);
template<typename Func>
void func(Func f)
{
[&](){
do {
do {
if (1)
foo(0);
} while(0);
} while (0);
};
}
};
}
void caller()
{
NS::A a;
a.func([&]{});
}
Fails like this on Raring:
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
redeclaration_
It compiles fine on Fedora 18's gcc 4.7.2 as well as a version of the upstream 4.7 branch that I just built today. (The latter calls itself 4.7.4.)
affects: | gcc-defaults (Ubuntu) → gcc-4.7 (Ubuntu) |
Changed in gcc-4.7 (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
"g++ -std=c++11" rejects the following program:
int main()
{
bool /*const*/ condition = false;
[&]{
if( condition) {}
try{}
catch(...){
}
}();
}
If the condition variable is const, the compilation successes.
Using built-in specs. LTO_WRAPPER= /home/user/ gcc-trunk/ libexec/ gcc/x86_ 64-unknown- linux-gnu/ 4.8.0/lto- wrapper unknown- linux-gnu /home/user/ gcc-trunk --disable-bootstrap --disable-multilib --enable- languages= c,c++,fortran --with- gmp=/home/ user/gcc- trunk/src/ build/backends --with- mpfr=/home/ user/gcc- trunk/src/ build/backends --with- mpc=/home/ user/gcc- trunk/src/ build/backends
COLLECT_GCC=g++
COLLECT_
Target: x86_64-
Configured with: ../gcc/configure --prefix=
Thread model: posix
gcc version 4.8.0 20130219 (experimental) (GCC)