www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14174] New: Weird IFTI deduction failure

https://issues.dlang.org/show_bug.cgi?id=14174

          Issue ID: 14174
           Summary: Weird IFTI deduction failure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

From: http://forum.dlang.org/thread/jbxscocwxabfwoatjsxa forum.dlang.org

Following code should work, but doesn't.

struct CborConfig(a, b) {}

struct NonSerialized {}

alias defaultCborConfig = CborConfig!(NonSerialized, NonSerialized);

void accepter(Config : CborConfig!(T) = defaultCborConfig, T...)()
{
    pragma(msg, T);
}

void main()
{
    //accepter!()();  // ok
    accepter();       // Line 15
}

output:

test.d(15): Error: template test.accepter cannot deduce function from argument
types !()(), candidates are:
test.d(7):        test.accepter(Config : CborConfig!T = defaultCborConfig,
T...)()

--
Feb 12 2015