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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [other/] [ptrmem1.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// { dg-do run }
// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 31 Dec 2001 
// Contributed by Nathan Sidwell 31 Dec 2001 
// PR 4379. We created pointers to member references and pointers to
// PR 4379. We created pointers to member references and pointers to
// member fields when we shouldn't have.
// member fields when we shouldn't have.
int gs;
int gs;
int gm;
int gm;
struct D {
struct D {
  D () :m (gm) {}
  D () :m (gm) {}
  int &m;
  int &m;
  static int &s;
  static int &s;
  int Foo ();
  int Foo ();
};
};
int &D::s = gs;
int &D::s = gs;
template int f1(T x)
template int f1(T x)
{
{
  return x != &gm;
  return x != &gm;
}
}
template int f2(T x)
template int f2(T x)
{
{
  return x != &gs;
  return x != &gs;
}
}
int D::Foo ()
int D::Foo ()
{
{
  int r;
  int r;
  if (f1( &(D::m)))
  if (f1( &(D::m)))
    return 3;
    return 3;
  if (f2( &D::s))
  if (f2( &D::s))
    return 1;
    return 1;
  if (f2( &(D::s)))
  if (f2( &(D::s)))
    return 2;
    return 2;
  return 0;
  return 0;
}
}
int Foo ()
int Foo ()
{
{
  if (f2( &D::s))
  if (f2( &D::s))
    return 4;
    return 4;
  if (f2( &(D::s)))
  if (f2( &(D::s)))
    return 5;
    return 5;
  return 0;
  return 0;
}
}
int main ()
int main ()
{
{
  D d;
  D d;
  int r = d.Foo ();
  int r = d.Foo ();
  if (r)
  if (r)
    return r;
    return r;
  r = Foo ();
  r = Foo ();
  if (r)
  if (r)
    return r;
    return r;
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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