On Friday, 4 November 2016 at 02:56:07 UTC, Paul Backus wrote:
When I compile this (using DMD 2.069 on Debian Linux), I get an error saying that I can't call visit from a pure function. This is surprising, since all visit does (in theory) is call the provided functions, and all of _them_ are pure.

My question is, is this an unavoidable limitation of visit's implementation, or is there a way to work around this?

I get the same error with 2.071. (I haven't installed the new dmd yet.)

I suggest trying it with the latest dmd and filing a bug report. Taking a quick look at the library code (https://github.com/dlang/phobos/blob/master/std/variant.d), it *seems* like everything uses templates and functions returning auto, so the pureness of visit should be inferred if possible.

Reply via email to