Bug 18976 – Inconsistency in overload merging with aliases

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-12T15:44:34Z
Last change time
2018-06-19T07:20:40Z
Keywords
pull
Assigned to
No Owner
Creator
Mathias LANG

Comments

Comment #0 by pro.mathias.lang — 2018-06-12T15:44:34Z
Consider the following code: ``` class Expression : Statement {} class Statement {} class AssertSemanticVisitor { void visit (const Statement node) { assert(0, typeof(node).stringof); } } class ExpressionVisitor : AssertSemanticVisitor { public void visit (Expression) { assert(0); } version (Deprecated) alias visit = super.visit; else version (FullType) alias visit = AssertSemanticVisitor.visit; else alias visit = typeof(super).visit; } void main () { scope x = new ExpressionVisitor; scope y = new Statement; x.visit(y); } ``` All three `alias` should have the same effect, bar for the deprecation newly implemented for the `Deprecated` version. However, the first 2 versions perform as expected, however the `else` clause leads to: ``` test.d(21): Error: alias `test.ExpressionVisitor.visit` conflicts with function test.ExpressionVisitor.visit at test.d(14) `` Marking it as major, as it makes the deprecation somewhat annoying.
Comment #1 by slavo5150 — 2018-06-12T19:37:31Z
Comment #2 by github-bugzilla — 2018-06-19T07:20:33Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/944402ec30e280af193130f9a287d56b5cb16c2f Fix Issue 18976 - Inconsistency in overload merging with aliases https://github.com/dlang/dmd/commit/0730f0a8a0274063f376eddd38aa7324f3019f81 Merge pull request #8355 from JinShil/fix_18976 Fix Issue 18976 - Inconsistency in overload merging with aliases