mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 21:51:03 +03:00

* Fix Issue 14128 - AliasDeclaration allows expressions, causing false code for ThisExp * Add test case * Fix deprecation comment * Add changelog * Use dummy out param, not null * Change to error with __edition_latest_do_not_use
28 lines
488 B
D
28 lines
488 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/alias_instance_member.d(18): Error: cannot alias member of variable `that`
|
|
fail_compilation/alias_instance_member.d(18): Use `typeof(that)` instead to preserve behaviour
|
|
---
|
|
*/
|
|
|
|
@__edition_latest_do_not_use
|
|
module aim;
|
|
|
|
struct Foo
|
|
{
|
|
int v;
|
|
void test(Foo that) const
|
|
{
|
|
alias a = this.v; // OK
|
|
alias b = that.v;
|
|
assert(&a is &b);
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
Foo a = Foo(1);
|
|
Foo b = Foo(2);
|
|
a.test(b);
|
|
}
|