getopt errors
Sebastiaan Koppe via D.gnu
d.gnu at puremagic.com
Thu Jan 21 04:06:18 PST 2016
This code:
bool time;
string fileIn;
string fileOut;
auto helpInformation = getopt(
args,
"time", "Show timing information", &time,
"i|input", "Input file (defaults to stdin)", &fileIn,
"o|output", "Output file (defaults to stdout)", &fileOut
);
if (helpInformation.helpWanted)
{
defaultGetoptPrinter("ECMAScript 5
minifier.\n\nUsage:\t"~baseName(args[0])~"
[OPTIONS]\n\nOptions:\n", helpInformation.options);
return 1;
}
on gdc 5.3.0-1 Gives me:
/usr/include/dlang/gdc/std/getopt.d:547:36: error: cannot modify
immutable expression *cast(immutable(char)*)receiver
if (incremental) ++*receiver;
^
/usr/include/dlang/gdc/std/getopt.d:548:22: error: cannot modify
immutable expression *cast(immutable(char)*)receiver
else *receiver = to!(typeof(*receiver))(val);
^
/usr/include/dlang/gdc/std/getopt.d:441:25: error: template
instance std.getopt.handleOption!string error instantiating
handleOption(option, receiver, args, cfg,
incremental);
^
/usr/include/dlang/gdc/std/getopt.d:392:22: note: instantiated
from here: getoptImpl!(string, string, bool*, string, string,
string*, string, string, string*)
return getoptImpl(args, cfg, opts);
^
source/app.d:24:31: note: instantiated from here: getopt!(string,
string, bool*, string, string, string*, string, string, string*)
auto helpInformation = getopt(
^
/usr/include/dlang/gdc/std/getopt.d:433:33: error: array index
[1] is outside array bounds [0 .. 1]
auto receiver = opts[1];
^
/usr/include/dlang/gdc/std/getopt.d:442:46: error: string slice
[2 .. 1] is out of bounds
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:13: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:30: error: template
instance std.getopt.getoptImpl!(string*) error instantiating
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:30: note: instantiated
from here: getoptImpl!(string, string, string*)
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:30: note: instantiated
from here: getoptImpl!(string, string*, string, string, string*)
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:30: note: instantiated
from here: getoptImpl!(bool*, string, string, string*, string,
string, string*)
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:392:22: note: instantiated
from here: getoptImpl!(string, string, bool*, string, string,
string*, string, string, string*)
return getoptImpl(args, cfg, opts);
^
source/app.d:24:31: note: instantiated from here: getopt!(string,
string, bool*, string, string, string*, string, string, string*)
auto helpInformation = getopt(
^
/usr/include/dlang/gdc/std/getopt.d:442:13: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:13: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:13: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:442:13: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts[2 .. $]);
^
/usr/include/dlang/gdc/std/getopt.d:392:5: error: cannot return
non-void from void function
return getoptImpl(args, cfg, opts);
^
source/app.d:33:3: error: undefined identifier
defaultGetoptPrinter
defaultGetoptPrinter("ECMAScript 5
minifier.\n\nUsage:\t"~baseName(args[0])~"
[OPTIONS]\n\nOptions:\n", helpInformation.options);
^
More information about the D.gnu
mailing list