mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
23 lines
352 B
D
23 lines
352 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail20448.d(16): Error: returning `p.x` escapes a reference to parameter `p`
|
|
fail_compilation/fail20448.d(22): Error: template instance `fail20448.member!"x"` error instantiating
|
|
---
|
|
*/
|
|
|
|
struct S
|
|
{
|
|
int x, y;
|
|
}
|
|
|
|
ref int member(string mem)(S p)
|
|
{
|
|
return p.x;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
S p;
|
|
p.member!"x" = 2;
|
|
}
|