auto r = replaceAll!((C) { return "X"; } )(s, regex(`Y`)); Error: static variable `thompsonFactory` cannot be read at compile time This is when the result is tried to be determined at compile time, e.g., assigning it to an enum even though s is known at compile time.