www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10658] New: Cannot merge template overload set by using alias declaration

http://d.puremagic.com/issues/show_bug.cgi?id=10658

           Summary: Cannot merge template overload set by using alias
                    declaration
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: pull, rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-07-16 23:56:09 PDT ---
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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 16 2013