1 // { dg-do run } 2 // GROUPS passed copy-ctors 3 #include <stdio.h> 4 5 int pass = 0; 6 class name { 7 int namestuff; 8 public: name()9 name() { 10 namestuff = 111; 11 } 12 name(const name& subject); 13 14 name & operator = (const name& right) { 15 this->namestuff = right.namestuff; 16 return *this; 17 } 18 ~name()19 ~name() { 20 ; 21 } 22 }; 23 name(const name & subject)24name::name(const name& subject) { 25 pass = 1; 26 } 27 28 class person { 29 int personstuff; 30 name personname; 31 public: person()32 person() { 33 ; 34 personstuff = 222; 35 } ~person()36 ~person() { 37 ; 38 } print()39 void print() { 40 ; 41 } 42 43 }; 44 45 void test(person argp)46test(person argp) 47 { 48 person testp; 49 50 ; 51 argp.print(); 52 testp = argp; 53 argp.print(); 54 testp.print(); 55 ; 56 } 57 main()58int main() 59 { 60 person mainp; 61 test(mainp); 62 if (pass) 63 printf ("PASS\n"); 64 else 65 { printf ("FAIL\n"); return 1; } 66 } 67 68