1 // PR c++/85873 2 // Test that these array temporaries are promoted to static variables as an 3 // optimization. 4 5 // { dg-do compile { target c++11 } } 6 // { dg-additional-options -fdump-tree-gimple } 7 // { dg-final { scan-tree-dump-not "= 42" "gimple" } } 8 9 #include <initializer_list> 10 f()11int f() 12 { 13 using AR = const int[]; 14 return AR{ 1,42,3,4,5,6,7,8,9,0 }[5]; 15 } 16 g()17int g() 18 { 19 std::initializer_list<int> a = {1,42,3}; 20 return a.begin()[0]; 21 } 22