D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10658 - Cannot merge template overload set by using alias declaration
Summary: Cannot merge template overload set by using alias declaration
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks: 1900
  Show dependency treegraph
 
Reported: 2013-07-16 23:56 UTC by Kenji Hara
Modified: 2017-07-19 07:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2013-07-16 23:56:09 UTC
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 github-bugzilla 2014-05-14 11:18:33 UTC
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