[Issue 18976] New: Inconsistency in overload merging with aliases
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 12 15:44:34 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18976
Issue ID: 18976
Summary: Inconsistency in overload merging with aliases
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: pro.mathias.lang at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list