enum type changes according to context ?
Timothee Cour
thelastmammoth at gmail.com
Thu Mar 28 16:02:18 PDT 2013
In code below, does transTable have a well defined type?
it seems to change from line 9 (string[char])
to line 10 (string[dchar])...
rdmd -version=bad main //CT erro
rdmd main //works
----
import std.string;
void main(){
version(bad){
auto transTable = ['[' : `\[`];
}
else{
enum transTable = ['[' : `\[`];
}
pragma(msg,typeof(transTable)); //string[char] always
auto s = translate("[", transTable); //CT error with -version=bad only
}
----
Error: translate (string str, string[dchar] transTable, string
toRemove = null) is not callable using argument types
(string,string[char])
More information about the Digitalmars-d-learn
mailing list