blob: 72997c524b85e3585b7fa4425bdd3beb8351e957 [file] [log] [blame]
Dan Gohmanfea1dd02009-08-25 15:38:29 +00001// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null
Tanya Lattnerd13e0ae2004-11-06 22:29:57 +00002
Chris Lattner4e44c0e2003-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 Lattner0f44ad32003-09-29 21:18:36 +00007struct C {
Jeff Cohenb02fbfc2005-04-23 21:26:11 +00008 int A, B;
9 ~C() {}
Chris Lattner0f44ad32003-09-29 21:18:36 +000010};
11
Chris Lattner4e44c0e2003-09-29 21:53:04 +000012void foo(C b);
13
Chris Lattner0f44ad32003-09-29 21:18:36 +000014void test(C *P) {
Jeff Cohenb02fbfc2005-04-23 21:26:11 +000015 foo(*P);
Chris Lattner0f44ad32003-09-29 21:18:36 +000016}
17