| 1 |
// { dg-do run } |
| 2 |
// { dg-options "-fstrub=internal" } |
| 3 |
// { dg-require-effective-target strub } |
| 4 |
|
| 5 |
// Check that we don't get extra copies. |
| 6 |
|
| 7 |
struct T { |
| 8 |
T &self; |
| 9 |
void check () const { if (&self != this) __builtin_abort (); } |
| 10 |
T() : self (*this) { check (); } |
| 11 |
T(const T& ck) : self (*this) { ck.check (); check (); } |
| 12 |
~T() { check (); } |
| 13 |
}; |
| 14 |
|
| 15 |
T foo (T q) { q.check (); return T(); } |
| 16 |
T bar (T p) { p.check (); return foo (p); } |
| 17 |
|
| 18 |
int main () { |
| 19 |
bar (T()).check (); |
| 20 |
} |