summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg/attr_flatten1.d
blob: 47bcc3883fbac4a693b438d0251fb2af2683728d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// { dg-do compile }
// { dg-options "-O1" }

import gcc.attributes;

int func() @flatten
{
    __gshared int count = 0;
    int nested_function()
    {
        return count++;
    }
    static foreach (_; 0 .. 1000)
        nested_function();

    return nested_function();
}

@flatten int var = 0; // { dg-warning ".flatten. attribute ignored" }

// { dg-final { scan-assembler-not "nested_function" } }