blob: 4873123d124176eba3373123cfa9bfc32bf3582d [file] [log] [blame]
Tanya Lattnerd13e0ae2004-11-06 22:29:57 +00001// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
2
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