summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/initlist-opt.C
blob: d17cda3f63a995b910af7d2ceb7cf160ef8742f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR c++/41997
// { dg-options "-std=c++0x -O2 -fdump-tree-optimized" }
// { dg-final { scan-tree-dump-not "_0" "optimized" } }
// { dg-final { cleanup-tree-dump "optimized" } }

#include <initializer_list>

inline int max_val(std::initializer_list<int> il)
{
        int i = *(il.begin());
        int j = *(il.begin() + 1);
        return (i > j ? i : j);
}

int main(void)
{
        return max_val({1,2});
}