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++.old-deja/] [g++.other/] [friend4.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 assemble  }
// { dg-do assemble  }
// by Alexandre Oliva 
// by Alexandre Oliva 
// I'm not 100% sure this program is correct, but g++ shouldn't just
// I'm not 100% sure this program is correct, but g++ shouldn't just
// crash.
// crash.
// The idea is to give privileged access to bar only to
// The idea is to give privileged access to bar only to
// specializations foo, for all B.
// specializations foo, for all B.
template  void foo();
template  void foo();
template  class bar {
template  class bar {
  int i; // { dg-error "" } private
  int i; // { dg-error "" } private
  template  friend void foo(); // { dg-error "" } bogus declaration
  template  friend void foo(); // { dg-error "" } bogus declaration
};
};
template  void foo() {
template  void foo() {
  bar baz; baz.i = 1;   // { dg-error "" } foo cannot access bar::i
  bar baz; baz.i = 1;   // { dg-error "" } foo cannot access bar::i
  bar buz; buz.i = 1; // { dg-error "" } foo cannot access bar::i
  bar buz; buz.i = 1; // { dg-error "" } foo cannot access bar::i
}
}
int main() {
int main() {
  foo();
  foo();
  foo();
  foo();
}
}
 
 

powered by: WebSVN 2.1.0

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