[dmd-internals] ref const(T) doesn't accept struct temporaries?

Sean Kelly sean at invisibleduck.org
Fri Dec 10 11:51:17 PST 2010


I suppose I should have already known this, but I was surprised today to find that this didn't work:

    auto val = x + seconds(y);

    Duration seconds(long x) { ... }

    struct Duration {
        Duration opOpAssign(string op)( ref const(Duration) other ) { ... }
    }

With the error:

    Error: function core.time.Duration.opOpAssign!("+").opOpAssign (ref const(Duration) other) is not callable using argument types (Duration)
    src/core/sync/config.d(59): Error: seconds(y) is not an lvalue

Someone please tell me that this is a bug and that it will be fixed soon.  A quick search on the bug tracker didn't turn up anything.


More information about the dmd-internals mailing list