Bug 18775 – DMD falsely reports deprecation for deprecated implicit casts that were not used in UFCS

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-04-18T14:17:52Z
Last change time
2018-04-23T07:55:43Z
Assigned to
No Owner
Creator
FeepingCreature
See also
https://issues.dlang.org/show_bug.cgi?id=12807

Comments

Comment #0 by default_357-line — 2018-04-18T14:17:52Z
Consider the following code: struct Foo { } struct Bar { deprecated @property Foo foo() { assert(false); return Foo.init; } alias foo this; } void test(Bar bar) { } void main() { Bar bar; bar.test; } bar.test will be satisfied via UFCS as test(bar). However, DMD first tries to find test in Bar, and hence via alias this in the deprecated property access to foo. It does not end up using the property access - but it still reports the deprecated warning on the property!
Comment #1 by ag0aep6g — 2018-04-19T05:28:28Z
This probably has the same root cause as issue 12807.
Comment #2 by default_357-line — 2018-04-19T10:52:19Z
Same piece of code, at least.
Comment #3 by github-bugzilla — 2018-04-23T07:55:42Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9e900ff6373d0d068f135c79292aba183ad25f2a Add testcase for issue 18775 https://github.com/dlang/dmd/commit/36cdbbffad2f70376ea46bd0b381bbfe586c669a Only emit warnings during alias this resolution if the alias this later actually turns out to lead to a valid property access. Fixes issues 18775, 12807 https://github.com/dlang/dmd/commit/d29d0041e8eee26c8fa3d7b50d4d3714f1e298bb Merge pull request #8194 from FeepingCreature/fix/18775-12807-fail-gently-on-alias-this Fix Issue 18775, 12807: gently resolve alias this