http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58972

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The behaviour looks like a gcc defect to me, not as a language problem. Note
that the similar code using a local class type causes the same kind of problem
for gcc:

//-------------------
class base
{
protected:
  typedef int type;
};

template <typename T>
class derive: public base
{
  using typename base::type;
public:
  void foo(type a)
  {
     struct f_t {
      f_t(type a) : a(a) {}
      bool operator()(type x) const { return x == a; }
      type a;
    } f(a);
    f(32);
  }
};

int main()
{
  derive<char> d;
  d.foo(23);
}
//-------------------

It seems to be a regression, because gcc 4.4.6 and earlier accepted the code.
According to 9.8 [class.local] p1 the wording says that it should be
well-formed:

"The local class is in the scope of the enclosing scope, and has the same
access to names outside the function as does the enclosing function."

Reply via email to