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.