view gcc/testsuite/g++.old-deja/g++.jason/return2.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

// { dg-do run  }
// PRMS Id: 5368
// Bug: the X temporary in foo() is not destroyed.

int c = 0;

struct X {
  X (int) { c++; }
  ~X() { c--; }
};

struct Y {
   Y(const X &) { }
};

Y foo() { 
  return X(3); 
}

int main()
{
  foo();
  return c;
}