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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [memfriend17.C] - Rev 801

Go to most recent revision | 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 "required" }

Go to most recent revision | 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.