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
PR c++/86728 - C variadic generic lambda.
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
init
/
init-ref1.C
blob
d0170cd18f6765431422533b1edbb17d962b90f7
1
// Submitted by Erik Rozendaal <dlr@acm.org>
2
// Test case for GNATS bug 787.
3
// { dg-do run }
4
5
#include <stdio.h>
6
#include <stdlib.h>
7
8
static int calls;
9
10
int &foo (int &arg)
11
{
12
calls++;
13
arg=0;
14
return arg;
15
}
16
17
int &identity (int &x)
18
{
19
return x;
20
}
21
22
int main()
23
{
24
int a;
25
26
calls = 0;
27
int &b = ++foo (a);
28
if (calls > 1)
29
abort ();
30
if (&a != &b)
31
abort ();
32
if (a != 1)
33
abort ();
34
35
calls = 0;
36
int &c = ++identity (++foo (a));
37
if (calls > 1)
38
abort ();
39
if (&a != &c)
40
abort ();
41
if (a != 2)
42
abort ();
43
44
exit (0);
45
}