Error: expression `update` of type `void` does not have a boolean value
Alex
sascha.orlov at gmail.com
Sat Sep 8 05:39:39 UTC 2018
On Saturday, 8 September 2018 at 03:12:56 UTC, Josphe Brigmo
wrote:
> auto foo(bool update = false)()
> {
> static if(update)
> { }
> }
>
> and the compiler, after upgrading to 2.082 from 2.080 now says:
>
> Error: expression `update` of type `void` does not have a
> boolean value
>
> when update is clearly a bool.
>
> Why the hell is the compiler now thinking update is a void?
>
> 1. This code compiles fine in a test app and 2. when I rename
> update to something else it works fine.
>
> 2. There is no other use of update in the entire module(not
> that it should matter)
>
> Seems this is a compiler bug but only has a problem in context.
> Remember, it worked find before I updated dmd and there is no
> reason why it shouldn't work.
Could you show some more code, as this works for me:
´´´
import std.stdio;
void main()
{
foo;
}
auto foo(bool update = false)()
{
static if(update)
{
}
}
´´´
compiled with
dmd --version
DMD64 D Compiler v2.082.0
Copyright (C) 1999-2018 by The D Language Foundation, All Rights
Reserved written by Walter Bright
dmd ./source/app.d
used on a Mac with Darwin Kernel Version 17.7.0
More information about the Digitalmars-d-learn
mailing list