compilers w/ different language features: version block
Seb
seb at wilzba.ch
Sun Feb 25 01:19:02 UTC 2018
On Sunday, 25 February 2018 at 00:42:20 UTC, Seb wrote:
> On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote:
>> [...]
>
> Are you looking for something like this?
>
> ---
> static if (__traits(compiles, () { static foreach (i; [0]){} }))
> version = supportsStaticForeach;
>
> void main()
> {
> version(supportsStaticForeach) {
> pragma(msg, "Yay, your compiler is new enough.");
> }
> }
> ---
>
>
> https://run.dlang.io/is/PZN5Nv
>
>> [...]
>
> Don't support GDC (or only GDC-master)?
Ah sorry I replied too fast. Yeah `mixin` is the only way to
workaround this if you really, really have to support GDC.
More information about the Digitalmars-d-learn
mailing list