Testing whether static foreach is available

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 06:38:52 PDT 2017


On Sunday, 10 September 2017 at 10:43:24 UTC, Petar Kirov 
[ZombineDev] wrote:
>
> Since Phobos always uses the latest compiler frontend, there's 
> nothing to check ;)

Here's an example of what I mean.

In D 2.074.0, std.format added some compile-time format string 
functionality. So if I compile with any DMD since then, I'm good 
to go. However, if I compile with LDC 1.3.0 or earlier (or an 
older DMD or GDC), then Phobos is at 2.073.2 (or earlier) and any 
unittests using this compile-time format will fail. So I was 
thinking I could put in a test for >= 2074 and put any code using 
the compile-time format string stuff in there.

I haven't tried it yet, but I was thinking that this would work 
rather than the compiles approach because I wouldn't think there 
is an issue with parsing the format compiles code. The issue is 
whether it is in phobos or not.


More information about the Digitalmars-d mailing list