OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [temporary2.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do assemble  }
// { dg-do assemble  }
class X // Indentation has been done so to see the similarities.
class X // Indentation has been done so to see the similarities.
{
{
public:
public:
  X() {}                  // { dg-message "note" } referenced below
  X() {}                  // { dg-message "note" } referenced below
         X(X& x) {x.i=7;} // { dg-message "note" } Both functions modify the
         X(X& x) {x.i=7;} // { dg-message "note" } Both functions modify the
  void bar(X& x) {x.i=7;} // { dg-message "note" } reference parameter x.
  void bar(X& x) {x.i=7;} // { dg-message "note" } reference parameter x.
  int i;
  int i;
};
};
X foo() { X x; return x; }
X foo() { X x; return x; }
int main()
int main()
{
{
  X   x(foo()); // { dg-error "no match" } Compiler doesn't warn about temporary reference.
  X   x(foo()); // { dg-error "no match" } Compiler doesn't warn about temporary reference.
  x.bar(foo()); // { dg-error "no match" } The same mistake is warned about in this case.
  x.bar(foo()); // { dg-error "no match" } The same mistake is warned about in this case.
}
}
 
 

powered by: WebSVN 2.1.0

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