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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.pt/] [ptrmem2.C] - Rev 749

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

// { dg-do run  }
struct S;

template <S* (S::*p)()>
struct F {
  S* f (S& s)
    {
      return (s.*p)();
    }
};

template <int S::*p>
struct D {
  void d (S& s)
    {
      (s.*p) = 3;
    }
};

struct S {
  S* g ();
  int i;
  F<&S::g> fg;
  D<&S::i> di;
  S* h(), k(F<&S::h>);
  F<&S::g> fg2;
  D<&S::i> di2;
};

S* S::g()
{
  return this;
}

S* S::h()
{
  return this;
}

int main()
{
  S s;
  s.i = 2;
  s.di.d (s);
  if (s.i != 3)
    return 1;
  if (s.fg2.f(s) != &s)
    return 1;
}

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.