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

2018-09-08 Thread Basile B. via Digitalmars-d-learn
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


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

2018-09-08 Thread Josphe Brigmo via Digitalmars-d-learn

On Saturday, 8 September 2018 at 07:30:35 UTC, Alex wrote:
On Saturday, 8 September 2018 at 06:56:40 UTC, Josphe Brigmo 
wrote:


My project does not use the term update at all in any other 
context except that one. But I did find:


void update(K, V, C, U)(ref V[K] aa, K key, scope C create, 
scope U update)


Ok... found something here:

https://dlang.org/changelog/2.082.0.html#require_update
and here:
https://dlang.org/spec/hash-map.html#advanced_updating

It seems, they were added in 2.082.0.

No idea why they are conflicting with your existing code, 
however... And even whether they are the source of conflict...


obviously who ever added it screwed the pooch.



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

2018-09-08 Thread Alex via Digitalmars-d-learn
On Saturday, 8 September 2018 at 06:56:40 UTC, Josphe Brigmo 
wrote:


My project does not use the term update at all in any other 
context except that one. But I did find:


void update(K, V, C, U)(ref V[K] aa, K key, scope C create, 
scope U update)


Ok... found something here:

https://dlang.org/changelog/2.082.0.html#require_update
and here:
https://dlang.org/spec/hash-map.html#advanced_updating

It seems, they were added in 2.082.0.

No idea why they are conflicting with your existing code, 
however... And even whether they are the source of conflict...


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

2018-09-08 Thread Josphe Brigmo via Digitalmars-d-learn

On Saturday, 8 September 2018 at 05:39:39 UTC, Alex wrote:
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


I can't, the code is from a very large project and it's too 
intertwined.


I already said it worked in simple form and that it worked with a 
previous compiler, so this is a regression.


Changing no code and only swapping compilers produces this bug...

and as you can see, it's obviously a bug given the form of the 
function and the error message and that it worked before without 
changes.


Why the specific term update? I don't know.

My project does not use the term update at all in any other 
context except that one. But I did find:


void update(K, V, C, U)(ref V[K] aa, K key, scope C create, scope 
U update)










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

2018-09-07 Thread Alex via Digitalmars-d-learn
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



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

2018-09-07 Thread Josphe Brigmo via Digitalmars-d-learn

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.