Bug 19936 – Deprecated alias get this falsely triggers on appending to array
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-06-03T08:02:26Z
Last change time
2019-06-04T09:57:46Z
Keywords
pull
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2019-06-03T08:02:26Z
Consider the following code:
struct Bla
{
deprecated("bla")
int get() { return 5; }
alias get this;
}
void main()
{
Bla[] blaArray;
blaArray ~= Bla();
}
There is no reason that appending to Bla[] should justify an access to the deprecated get() function. And yet, when compiled with `-de`, `blaArray ~= Bla()` errors with a deprecation error. Note that this does not happen with `blaArray ~ Bla()`.
Comment #1 by default_357-line — 2019-06-03T08:04:49Z
Oh, and it's a regression too (since 2.084.1).
Comment #2 by dlang-bot — 2019-06-03T08:51:16Z
@FeepingCreature created dlang/dmd pull request #9953 "Fix issue 19936: `alias deprecated get this` falsely triggers deprecation on `array ~=`" fixing this issue:
- Fix issue 19936: don't attempt alias-this for the rhs of an opAppend overload if no applicable overload was found in the lhs.
https://github.com/dlang/dmd/pull/9953
Comment #3 by dlang-bot — 2019-06-04T09:57:46Z
dlang/dmd pull request #9953 "[REG 2.084.1] Fix issue 19936: `alias deprecated get this` falsely triggers deprecation on `array ~=`" was merged into stable:
- 1885840b3151eae627a2127d055437b2ea2ac357 by Mathis Beer:
Fix issue 19936: don't attempt alias-this for the rhs of an opAppend overload if no applicable overload was found in the lhs
https://github.com/dlang/dmd/pull/9953