This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/56820] elaborated-type-specifier friend incorrectly looked up beyond innermost enclosing namespace


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-16
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed.

namespace outer
{
  template<class T> struct B;

  namespace inner
  {
    template<class U> class A
    {
      template<class T> friend struct B;

      A() {}
    };
  }

  template<class T> struct B
  {
    B() { inner::A<int> a; }
  };
}

outer::B<int> b;


The friend declaration only matches outer::B when both A and B are class
templates. If either is a non-template then the friend declaration correctly
declares outer::inner::B.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]