dmd/compiler/test/fail_compilation/fail20448.d
2022-07-09 18:53:07 +02:00

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;
}