www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12111] New: Cannot pull a function template into an overload set

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12111

           Summary: Cannot pull a function template into an overload set
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: cbkbbejeap mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap mailinator.com> 2014-02-08
12:46:24 PST ---
Works with regular functions, but not function templates:

------------------------------
module a;
import b;

alias foo = b.foo;
void foo(T)(T t) if(is(T==char)) {}

void main() { foo(1); }
------------------------------
module b;
void foo(T)(T t) if(is(T==int)) {}
------------------------------ 

Error: template a.foo(T)(T t) if (is(T == char)) conflicts with alias a.foo at
a.d(4)

FWIW, The problem does not appear to be related to the "if(...)" constraints,
because using these foo's has the same problem:

void foo(T)(int[T] t) {}
void foo(T)(T[] t) {}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12111



--- Comment #1 from Nick Sabalausky <cbkbbejeap mailinator.com> 2014-02-08
13:22:53 PST ---
Workaround:

------------------------------
module a;
import b;

alias foo = b.foo;
void foo(T)(T t) if(is(T==char)) {}
void foo(T)(T t) if(is(T==int)) { b.foo(t); } // Workaround for #12111

void main() { foo(1); }
------------------------------
module b;
void foo(T)(T t) if(is(T==int)) {}
------------------------------

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2014