[Issue 688] New: Implicit function template match doesn't work for classes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 13 22:31:56 PST 2006


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

           Summary: Implicit function template match doesn't work for
                    classes
           Product: D
           Version: 0.177
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


IFTI works fine for structs in the case below, but doesn't work for classes.
Here's the code:

-----
// With DMD 0.177
// Error:
// template xxx.bar_class(T) does not match any template declaration
// template xxx.bar_class(T) cannot deduce template function from argument 
//         types (FooClass,FooClass)

class FooClass(T) {  T data; }

struct FooStruct(T) {  T data;  }

void bar_struct(T)(FooStruct!(T) a) {}

void bar_class(T)(FooClass!(T) a) {}

void main()
{
    auto C = new FooClass!(double);
    FooStruct!(double) S;

    bar_struct(S);  // works
    bar_class!(double)(C);  // works
    bar_class(C);   // does not work
}


-- 



More information about the Digitalmars-d-bugs mailing list