www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - odd atomicOp errors from vibe-core

reply Steven Schveighoffer <schveiguy gmail.com> writes:
I'm building a library that uses vibe-core as an indirect dependency. 
Specifically, I'm testing the library with dub test.

A very odd thing happens as I'm picking off compiler errors one at a 
time. After all the errors that I created are listed, I get this list:

../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1546,16): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "+=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1548,28): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("-=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/
ore/sync.d(327,10): 
Error: template instance vibe.core.sync.TaskMutexImpl!false error 
instantiating
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1546,16): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "+=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1548,28): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("-=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/
ore/sync.d(426,10): 
Error: template instance vibe.core.sync.TaskMutexImpl!true error 
instantiating
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1607,16): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "+=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1609,28): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("-=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/
ore/sync.d(467,10): 
Error: template instance vibe.core.sync.RecursiveTaskMutexImpl!false 
error instantiating
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1607,16): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "+=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(1609,28): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("-=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/
ore/sync.d(493,10): 
Error: template instance vibe.core.sync.RecursiveTaskMutexImpl!true 
error instantiating
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2006,22): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "+=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2008,26): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("-=")(shared(uint), int), candidates are:
/home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/co
e/atomic.d(543,14): 
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2107,42): 
Error: template instance 
vibe.core.sync.ReadWriteMutexState!false.ReadWriteMutexState.lock!cast
LockingIntent)false 
error instantiating
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2111,20): 
        instantiated from here: Mutex!cast(LockingIntent)false
../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2006,22): 
Error: template core.atomic.atomicOp cannot deduce function from 
argument types !("+=")(shared(uint), int), candidates are:

And then it just abruptly ends there.

I'm not sure why all these errors come out. Looking at the code, it 
seems to have nothing to do with my code. Once I fix my code errors 
(which are legitimate errors that I made), then these mysteriously go 
away. I'm not calling any of these functions that it's spitting out.

Why are these being triggered? Why do they all of a sudden go away? Does 
anyone else see this? Is it specifically something with vibe-core? Is it 
something to do with dub?

-Steve
Apr 09 2020
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer 
wrote:
 I'm building a library that uses vibe-core as an indirect 
 dependency. Specifically, I'm testing the library with dub test.

 [...]
Those are signed unsigned mismatches when it tries to lock. that's probably in vibe-d
Apr 09 2020
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 4/9/20 11:22 PM, Stefan Koch wrote:
 On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer wrote:
 I'm building a library that uses vibe-core as an indirect dependency. 
 Specifically, I'm testing the library with dub test.

 [...]
Those are signed unsigned mismatches when it tries to lock. that's probably in vibe-d
Can you explain why I do not get the errors when I have taken care of my errors? It doesn't make a whole lot of sense to me. -Steve
Apr 09 2020
parent Mathias LANG <geod24 gmail.com> writes:
On Friday, 10 April 2020 at 03:26:04 UTC, Steven Schveighoffer 
wrote:
 On 4/9/20 11:22 PM, Stefan Koch wrote:
 On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer 
 wrote:
 I'm building a library that uses vibe-core as an indirect 
 dependency. Specifically, I'm testing the library with dub 
 test.

 [...]
Those are signed unsigned mismatches when it tries to lock. that's probably in vibe-d
Can you explain why I do not get the errors when I have taken care of my errors? It doesn't make a whole lot of sense to me. -Steve
I've observed this behavior as well. From what can tell, it's a false positive that only shows up in the presence of previous error. I'd say that has something to do with the way the compiler do semantic analysis. My money is on the fact that `core.atomic` is special, and that something else (bad error gagging, perhaps?) triggers an error. As far as I can tell, it is safe to ignore. If you can reduce it to something small enough, I'd say it's worthy of an issue tho.
Apr 10 2020
prev sibling parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer 
wrote:
 I'm building a library that uses vibe-core as an indirect 
 dependency. Specifically, I'm testing the library with dub test.

 A very odd thing happens as I'm picking off compiler errors one 
 at a time. After all the errors that I created are listed, I 
 get this list:
[--snip--]
 Error: template core.atomic.atomicOp cannot deduce function 
 from argument types !("-=")(shared(uint), int), candidates are:
 /home/steves/.dvm/compilers/dmd-2.091.0/linux/bin/../../src/druntime/import/core/atomic.d(543,14):
        atomicOp(string op, T, V1)(ref shared T val, V1 mod)
   with op = "-=",
        T = uint,
        V1 = int
   must satisfy the following constraint:
        __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))
[--snip--]
 ../../../.dub/packages/vibe-core-1.9.0/vibe-core/source/vibe/c
re/sync.d(2006,22): Error: template core.atomic.atomicOp cannot deduce function
from argument types !("+=")(shared(uint), int), candidates are:

 And then it just abruptly ends there.

 I'm not sure why all these errors come out. Looking at the 
 code, it seems to have nothing to do with my code. Once I fix 
 my code errors (which are legitimate errors that I made), then 
 these mysteriously go away. I'm not calling any of these 
 functions that it's spitting out.

 Why are these being triggered? Why do they all of a sudden go 
 away? Does anyone else see this? Is it specifically something 
 with vibe-core? Is it something to do with dub?
This is a regression caused by https://github.com/dlang/dmd/pull/10711
Apr 12 2020
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 4/12/20 6:30 AM, Iain Buclaw wrote:

 
 This is a regression caused by https://github.com/dlang/dmd/pull/10711
Thanks for finding that! I wasn't sure where the culprit was. -Steve
Apr 12 2020