Error: expression `update` of type `void` does not have a boolean value

Basile B. b2.temp at gmx.com
Sat Sep 8 14:46:09 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.

- put

`pragma(msg, __FILE_FULL_PATH__ ~ "(" ~ __LINE__.stringof ~ "):" ~
     typeof(return).stringof);`

in your update function.

- recompile.
- look at the compiler output

You should be sure at this point if the problem comes from your 
update function of from the recent addition in object.d


More information about the Digitalmars-d-learn mailing list