Heya. I'm working on a simple units-of-measure implementation in DMD 2.066.0, and it doesn't seem to like the signature of my '*' operator below. I'm afraid I don't understand what the error description is trying to tell me. Here's a reduced case:

public struct UnitDef(string unitString) {
        // Error: "specialization not allowed for deduced parameter N"
auto opBinary(string op, UT : UnitDef!N, string N)(UT rhs) if (op == "*") {
                return UnitDef!(unitString ~ " " ~ N)();
        }
}

enum ft = UnitDef!"ft"();
enum s = UnitDef!"s"();

pragma(msg, typeof(ft*s));

I've tried the same code in DPaste, and it compiles just fine.


Can anyone shed some light on what I may be doing wrong? I always seem to get bitten when working with template arguments, so it's probably just me.

Reply via email to