dmd extern.d
extern.d(22): Error: undefined identifier r, did you mean template tr(C1, C2, C3 , C4 = immutable(char))(C1[] str, const(C2)[] from, const(C3)[] to, const(C4)[]
modifiers = null)?
extern.d(22): Error: '__error' must be of integral or string type, it is a _erro
r_

dmd extern.d
extern.d(23): Error: undefined identifier r, did you mean variable t? extern.d(23): Error: '__error' must be of integral or string type, it is a _erro
r_

It was typo. Sample code:

import std.stdio;
import std.typecons;

immutable string externFmt = "extern (C) %s %s (%s);";

enum FnType : ubyte { Unknown, Constructor, Function, GlobalFunction }

Tuple!(string[], FnType) parse(string source)
{
    return tuple(new string[2], FnType.Unknown);
}

void main(string[] args)
{
    writeln(parse(null));

    foreach (line; stdin.byLine())
    {
        auto result = parse(line.idup); // or missed idup
        //auto t = result[1]; // or typo here

        final switch (result[1])
        {
            case FnType.Constructor: break;
            case FnType.Function: break;
            case FnType.GlobalFunction: break;
            case FnType.Unknown: break;
        }
    }
}

is it normal?

Reply via email to