OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [template/] [memfriend17.C] - Rev 301

Compare with Previous | Blame | View Log

// { dg-do compile }

// Origin: Giovanni Bajo <giovannibajo@libero.it>

// PR c++/13495: Nested class as template friend.

template<typename T>
class A{
public:
    class B
    {
        void func1(void);
        void func2(void);
    };
};

template<typename Q>
class F1
{
    friend class A<Q>::B;
    enum { foo = 0 };   // { dg-error "private" }
};

template<typename Q>
class F2
{
    template<typename T>
    friend class A<T>::B;
    enum { foo = 0 };
};

template <typename T>
void A<T>::B::func1(void)
{
    (void)F1<T>::foo;
    (void)F2<T>::foo;
}

template <typename T>
void A<T>::B::func2(void)
{
    (void)F1<T*>::foo;  // { dg-error "context" }
    (void)F2<T*>::foo;
}

template class A<int>;  // { dg-message "instantiated" }

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.