Compiler error with slices, .dup and ref Parameter
anynomous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Nov 20 00:37:09 PST 2014
module a;
void init (ref string[] argv) { }
void main(string[] args) {
init(args); //ok
auto y = args[1..$];
init(y); //ok
auto x = args.dup;
init(x); //ok
init(args[1..$]); // Error: function a.init (ref string[]
argv) is not callable using argument types (string[])
init(args.dup); // Error: function a.init (ref string[] argv)
is not callable using argument types (string[])
}
tested with
dmd 2.066.0
ldc 0.15 beta (Frontend 2.066.1)
Similar Errors occure with int[].
Is this a bug that should be reported or is there some reason for
the errors?
I searched for an issue the bugtracker and did not find a
matching one.
The error messages are strange anyway.
More information about the Digitalmars-d-learn
mailing list