[Bug c++/15453] New: Friend declaration not treated as a declaration in scope.

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Sat May 15 18:25:00 GMT 2004


In the following example:

template<typename G, template<typename H> class I = B>
class J;

template<typename C, template<typename D> class E>
class F {
    template<typename G, template<typename H> class I = B>
    friend
    class J;
    template<typename K, template<typename L> class M = B>
    friend
    class N;
    friend
    class O;

    J<int, B>* j;
    N<int, B>* n;
    O* o;
    };

int main() {
    return 0;
    }

N appears to not be recognized as a template (in the declaration of n) based on its declaration as a template friend, whereas exactly the same declaration with an additional declaration in file scope is acceptable (template class J, declaring j), as is a friend declaration of a plain class. The c++ rules in this area are incomprehensible to me, but admitting friend declarations in one case and not the other seems unreasonable if not incorrect.

Ivan

-- 
           Summary: Friend declaration not treated as a declaration in
                    scope.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list