blob: 72997c524b85e3585b7fa4425bdd3beb8351e957 [file] [log] [blame]
Dan Gohman0d4bbf22009-08-25 15:38:29 +00001// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null
Tanya Lattnerd9a3ceb2004-11-06 22:29:57 +00002
Chris Lattnerff06e882003-09-29 21:53:04 +00003// Non-POD classes cannot be passed into a function by component, because their
4// dtors must be run. Instead, pass them in by reference. The C++ front-end
5// was mistakenly "thinking" that 'foo' took a structure by component.
6
Chris Lattner4a9eeed2003-09-29 21:18:36 +00007struct C {
Jeff Cohen8047f132005-04-23 21:26:11 +00008 int A, B;
9 ~C() {}
Chris Lattner4a9eeed2003-09-29 21:18:36 +000010};
11
Chris Lattnerff06e882003-09-29 21:53:04 +000012void foo(C b);
13
Chris Lattner4a9eeed2003-09-29 21:18:36 +000014void test(C *P) {
Jeff Cohen8047f132005-04-23 21:26:11 +000015 foo(*P);
Chris Lattner4a9eeed2003-09-29 21:18:36 +000016}
17