Public bug reported:

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_bug.cc: In instantiation of 'NS::A::func(Func) [with Func = 
caller()::<lambda()>]::<lambda()>':
redeclaration_bug.cc:14:11:   required from 'struct NS::A::func(Func) [with 
Func = caller()::<lambda()>]::<lambda()>'
redeclaration_bug.cc:10:5:   required from 'void NS::A::func(Func) [with Func = 
caller()::<lambda()>]'
redeclaration_bug.cc:26:15:   required from here
redeclaration_bug.cc:14:11: error: redeclaration of 'NS::A* const 
NS::A::func(Func) [with Func = caller()::<lambda()>]::<lambda()>::__this'
redeclaration_bug.cc:14:11: note: previous declaration 'NS::A* const 
NS::A::func(Func) [with Func = caller()::<lambda()>]::<lambda()>::__this'
redeclaration_bug.cc:14:11: error: redeclaration of 'NS::A* const this'
redeclaration_bug.cc:14:11: error: 'NS::A* const this' previously declared here
redeclaration_bug.cc: In instantiation of 'void NS::A::func(Func) [with Func = 
caller()::<lambda()>]':
redeclaration_bug.cc:26:15:   required from here
redeclaration_bug.cc:10:5: error: too many initializers for 'NS::A::func(Func) 
[with Func = caller()::<lambda()>]::<lambda()>'

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)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1172951

Title:
  gcc 4.7.3-1ubuntu10 c++11 bogus errors (reduced, not reproducible
  upstream)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1172951/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to