[Issue 22859] Error: forward reference of variable `isAssignable` for mutually recursed `allSatisfy`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 18 12:51:24 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22859
--- Comment #3 from Tomoya Tanjo <ttanjo at gmail.com> ---
I reduced it as follows:
```d
private struct __InoutWorkaroundStruct {}
@property T rvalueOf(T)(T val) { return val; }
@property T rvalueOf(T)(inout __InoutWorkaroundStruct =
__InoutWorkaroundStruct.init);
@property ref T lvalueOf(T)(inout __InoutWorkaroundStruct =
__InoutWorkaroundStruct.init);
// taken from std.traits.isAssignable
template isAssignable(Lhs, Rhs = Lhs)
{
enum isAssignable = __traits(compiles, lvalueOf!Lhs = rvalueOf!Rhs) &&
__traits(compiles, lvalueOf!Lhs = lvalueOf!Rhs);
}
// taken from std.meta.allSatisfy
template allSatisfy(alias F, T...)
{
static foreach (Ti; T)
{
static if (!is(typeof(allSatisfy) == bool) && // not yet defined
!F!(Ti))
{
enum allSatisfy = false;
}
}
static if (!is(typeof(allSatisfy) == bool)) // if not yet defined
{
enum allSatisfy = true;
}
}
struct None{}
class C1
{
static if(allSatisfy!(isAssignable, None, C2)) {}
}
class C2
{
static if(allSatisfy!(isAssignable, None, C1, C2)) {}
}
void main() {}
```
Finally, I found that it was introduced by
https://github.com/dlang/dmd/pull/13588.
Here is an output of `git bisect`:
```console
$ cat test.sh
#!/bin/sh
make -f posix.mak AUTO_BOOTSTRAP=1 -j
./generated/linux/release/64/dmd -c issue22859.d
$ git bisect start v2.099.0 v2.089.1
$ git bisect run ./test.sh
...
5436d4d167e41f59b799071d8136bb051c87ae56 is the first bad commit
commit 5436d4d167e41f59b799071d8136bb051c87ae56
Author: Iain Buclaw <ibuclaw at gdcproject.org>
Date: Sun Jan 30 16:42:45 2022 +0100
fix Issue 22714 - ICE: Assertion failure in ClassDeclaration::isBaseOf
...
```
Note: To make it bisectable, I fixed
/workspaces/druntime/src/core/sys/darwin/mach/nlist.d (L225 only) to v2.098.1.
--
More information about the Digitalmars-d-bugs
mailing list