repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
cpp0x
/
initlist6.C
blob
3d02960b9614936a91c771c4679915a2a577832d
1
// Test for initlist lifetime
2
// { dg-do run { target c++11 } }
3
4
#include <initializer_list>
5
6
int c;
7
8
struct A
9
{
10
A(int,int) { ++c; }
11
~A() { --c; }
12
};
13
14
void f (std::initializer_list<A> l) { }
15
16
int main()
17
{
18
f({ {1,2}, {3,4} });
19
if (c != 0)
20
return 1;
21
22
{
23
std::initializer_list<A> l { {1,2}, {3,4} };
24
if (c != 2)
25
return 2;
26
}
27
if (c != 0)
28
return 3;
29
}