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

            Bug ID: 59256
           Summary: qualified name in friend function declaration doesn't
                    match previous declaration in inline namespace
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

I *think* this is valid, and clang accepts it, but G++ doesn't:

namespace detail {
  inline namespace v7 {
    void f();
  }
}

inline namespace v7 {
  template<typename T> class A {
  private:
    A() { }

    friend void detail::f();
  };
}

namespace detail {
  inline namespace v7 {
    void f() { A<int> a; }
  }
}

int main()
{
  detail::f();
}


$ g++ -std=gnu++11 n.cc
n.cc: In function ‘void detail::v7::f()’:
n.cc:10:5: error: ‘v7::A<T>::A() [with T = int]’ is private
     A() { }
     ^
n.cc:18:23: error: within this context
     void f() { A<int> a; }
                       ^


I think the qualified name detail::f should find ::detail::v7::f

Reply via email to