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
MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git]
/
gcc
/
testsuite
/
gdc.test
/
fail_compilation
/
test20809.d
blob
0b452774245f7315b10e3677086c673477536a3c
1
/*
2
REQUIRED_ARGS:
3
TEST_OUTPUT:
4
---
5
fail_compilation/test20809.d(114): Error: returning `this.a` escapes a reference to parameter `this`
6
fail_compilation/test20809.d(112): perhaps annotate the function with `return`
7
---
8
*/
9
10
// https://issues.dlang.org/show_bug.cgi?id=20809
11
12
#line
100
13
14
@safe
:
15
16
struct
S
17
{
18
@safe
:
19
int
a
;
20
~
this
()
21
{
22
a
=
0
;
23
}
24
25
ref int
val
()
26
{
27
return
a
;
28
}
29
}
30
31
S
bar
()
32
{
33
return
S
(
2
);
34
}
35
36
int
foo
()
37
{
38
return
bar
.
val
;
39
}
40
41
void
test
()
42
{
43
assert
(
foo
() ==
2
);
44
}