cast to pure function stop work after upgrade
baby_tiger
tiger2021y at gmail.com
Mon Jun 14 13:31:51 UTC 2021
this used work for me, after upgrade I get this error. how to
fix it ?
import std.traits;
enum LogLevel : ubyte {
INFO = 0,
WARN,
ERROR,
FATAL,
}
extern (C) string VFORMAT(LogLevel level, string file, size_t
line, char[] tmp, bool line_break, string tag, string fmt, ...)
@nogc nothrow {
return null;
}
template asPure(string P, alias Fn) if
(isFunctionPointer!(typeof(&Fn))) {
enum N = __traits(identifier, Fn);
enum string asPure = "private alias " ~ N ~ "_PURE =
" ~ typeof(&Fn).stringof ~ " pure;\n" ~ "__gshared immutable " ~
N ~ "_PURE " ~ P ~"= cast(" ~ N ~ "_PURE) &" ~ N ~ " ;" ;
}
enum xx = asPure!("VFORMATP", VFORMAT);
mixin(xx);
void main(){
}
reinterpreting cast from `nothrow @nogc extern (C)
string(LogLevel level, string file, ulong line, char[] tmp, bool
line_break, string tag, string fmt, ...)*` to `pure nothrow @nogc
extern (C) string(LogLevel, string, ulong, char[], bool, string,
string, ...)*` is not supported in CTFE
More information about the Digitalmars-d-learn
mailing list