gcc/testsuite/gdc.dg/attr_flatten1.d
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-O1" } |
| 3 | |
| 4 | import gcc.attributes; |
| 5 | |
| 6 | int func() @flatten |
| 7 | { |
| 8 | __gshared int count = 0; |
| 9 | int nested_function() |
| 10 | { |
| 11 | return count++; |
| 12 | } |
| 13 | static foreach (_; 0 .. 1000) |
| 14 | nested_function(); |
| 15 | |
| 16 | return nested_function(); |
| 17 | } |
| 18 | |
| 19 | @flatten int var = 0; // { dg-warning ".flatten. attribute ignored" } |
| 20 | |
| 21 | // { dg-final { scan-assembler-not "nested_function" } } |