Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.old-deja/g++.mike/p3579.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// { dg-do run } // prms-id: 3579 extern "C" int printf(const char *, ...); int num_x; class Y { public: Y () { printf("Y() this: %x\n", this); } ~Y () { printf("~Y() this: %x\n", this); } }; class X { public: X () { ++num_x; printf("X() this: %x\n", this); Y y; *this = (X) y; } X (const Y & yy) { printf("X(const Y&) this: %x\n", this); ++num_x; } X & operator = (const X & xx) { printf("X.op=(X&) this: %x\n", this); return *this; } ~X () { printf("~X() this: %x\n", this); --num_x; } }; int main (int, char **) { { X anX; } if (num_x) { printf("FAIL\n"); return 1; } printf("PASS\n"); return 0; }