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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.pt/] [friend44.C] - Rev 823

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do compile }
// Test that template friends referring to class template members are
// respected.


template <class T> struct A
{
  int f (T);
  struct AI {
    int f (T);
  };
};

class B
{
  template <class T> friend int A<T>::f (T);
  template <class T> friend struct A<T>::AI;
  int a;
public:
  B(): a(0) { }
};

template <class T> int A<T>::f (T)
{
  B b;
  return b.a;
}

template <class T> int A<T>::AI::f (T)
{
  B b;
  return b.a;
}

int main ()
{
  A<int> a;
  A<int>::AI ai;

  int r = a.f (0);
  r |= ai.f (0);

  return r;
}

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.