| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
// { dg-final { scan-tree-dump-times " bar<int> \\\(1, 2, 3\\\);" 1 "optimized" } } |
| 4 |
// { dg-final { scan-tree-dump-times " bar<int> \\\(4, 5, 6\\\);" 1 "optimized" } } |
| 5 |
|
| 6 |
template <typename T, typename U> |
| 7 |
[[gnu::noipa]] U |
| 8 |
foo (T x, T y, T z) [[gnu::unsequenced]] |
| 9 |
{ |
| 10 |
*x = 1; |
| 11 |
*y = 2; |
| 12 |
*z = 3; |
| 13 |
} |
| 14 |
|
| 15 |
template <typename T> |
| 16 |
[[gnu::noipa]] T |
| 17 |
bar (T x, T y, T z) [[gnu::unsequenced]] |
| 18 |
{ |
| 19 |
return x + y + z; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
baz () [[gnu::unsequenced]] |
| 24 |
{ |
| 25 |
int x, y, z; |
| 26 |
foo <int *, void> (&x, &y, &z); |
| 27 |
return x; |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
qux () [[gnu::unsequenced]] |
| 32 |
{ |
| 33 |
int a = bar (1, 2, 3); |
| 34 |
int b = bar (1, 2, 3); |
| 35 |
int c = bar (1, 2, 3); |
| 36 |
int d = bar (4, 5, 6); |
| 37 |
int e = bar (4, 5, 6); |
| 38 |
int f = bar (4, 5, 6); |
| 39 |
return a + b + c + d + e + f; |
| 40 |
} |
| 41 |
|
| 42 |
template <typename T, typename U> |
| 43 |
[[gnu::noipa]] U |
| 44 |
corge (T x, T y, T z) [[gnu::unsequenced]] // { dg-warning "'unsequenced' attribute on function type without pointer arguments returning 'void'" } |
| 45 |
{ |
| 46 |
x += y + z; |
| 47 |
} |
| 48 |
|
| 49 |
void |
| 50 |
freddy () |
| 51 |
{ |
| 52 |
corge <int, void> (1, 2, 3); |
| 53 |
} |