The problem is that yyfilename
, and the return value of toStringz
when it is passed a string, have different const qualifiers. filename
is immutable (D string
is an alias to immutable(char)[]
), however yyfilename
does not have any const qualifier, and is thus mutable.
You have two options:
- If you know that
yyfilename
will not bemodified elsewhere in your program, you should declare it asconst(char)*
instead ofchar*
. - Otherwise, you should create a copy of
filename
when converting it:toUTFz!(char*)(filename)
.