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/] [init/] [elide2.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
// PR c++/8674
// PR c++/8674
// Bug: Since B().a is an rvalue, we tried to treat it like a TARGET_EXPR
// Bug: Since B().a is an rvalue, we tried to treat it like a TARGET_EXPR
// and elide the copy.  But that produces a bitwise copy, which causes us
// and elide the copy.  But that produces a bitwise copy, which causes us
// to abort in cp_expr_size.
// to abort in cp_expr_size.
// Test that we actually run the A copy constructor when calling f().
// Test that we actually run the A copy constructor when calling f().
// { dg-do run }
// { dg-do run }
int c;
int c;
struct A
struct A
{
{
  A () { ++c; }
  A () { ++c; }
  A (const A&) { ++c; }
  A (const A&) { ++c; }
};
};
struct B
struct B
{
{
  A a;
  A a;
};
};
void f (A) { }
void f (A) { }
int main ()
int main ()
{
{
  f (B().a);
  f (B().a);
  return c < 2;
  return c < 2;
}
}
 
 

powered by: WebSVN 2.1.0

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