Bug 10658 – Cannot merge template overload set by using alias declaration

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-16T23:56:00Z
Last change time
2017-07-19T07:09:43Z
Keywords
rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Blocks
1900
See also
https://issues.dlang.org/show_bug.cgi?id=16160

Comments

Comment #0 by k.hara.pg — 2013-07-16T23:56:09Z
It works with function overload set, but doesn't work with template overload set. Test case: ------------------------- module a; auto foo(int) { return 1; } template Bar(int n) { enum Bar = 1; } ------------------------- module b; auto foo(long) { return 2; } template Bar(long n) { enum Bar = 2; } ------------------------- module test; import a, b; alias foo = a.foo; alias foo = b.foo; // OK static assert(foo(1) == 1); // OK static assert(foo(1L) == 2); // OK alias Bar = a.Bar; // test.d(9) alias Bar = b.Bar; // doesn't work [X] //static assert(Bar!1 == 1); //static assert(Bar!1L == 2); ------------------------- [X]: test.d(10): Error: alias test.Bar conflicts with alias test.Bar at test.d(9)
Comment #1 by github-bugzilla — 2014-05-14T11:18:33Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5019a5798ffd2c3154e870966c038185330a2c36 fix Issue 10658 - Cannot merge template overload set by using alias declaration - Add OverDeclaration and see it in overloadApply. - Use OverDeclaration for template overload set merging. - Check OverDeclaration in DotVarExp and VarExp. https://github.com/D-Programming-Language/dmd/commit/994f1ead17bdf9a3c4a3e414395b14c4d897245e Merge pull request #2417 from 9rnsr/fix10658 Issue 10658 - Cannot merge template overload set by using alias declaration