I don't understand a const

bearophile bearophileHUGS at lycos.com
Wed Sep 1 19:22:22 PDT 2010


This program doesn't compile, dmd prints the errors:
test.d(4): Error: template test.foo(T) does not match any function template declaration
test.d(4): Error: template test.foo(T) cannot deduce template function from argument types !()(const(int),int)
test.d(9): Error: template instance test.bar!(int) error instantiating

Are you able to tell me what is the error in this code?


void foo(T)(const T a, out T b) {}

void bar(T)(const T x, out T y) {
    foo(x, y); // line 4
}

void main() {
    int s1, s2;
    bar(s1, s2); // line 9
}


Bye, and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list