Bug 23128 – Attributes inference breaks down with cycles
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-05-20T12:35:01Z
Last change time
2022-10-03T14:30:10Z
Assigned to
No Owner
Creator
kinke
Comments
Comment #0 by kinke — 2022-05-20T12:35:01Z
```
struct S {
int x;
int getX()() { return !x ? getY() : x; }
int getY()() { return !x ? -1 : getX(); }
}
static assert(__traits(compiles, (S s) @safe => s.getX())); // fails
```
@safety of getX() depends on getY(), and vice-versa. The compiler currently simply falls back to @system. It should probably try harder to resolve such cyclic dependencies.
Comment #1 by dkorpel — 2022-10-03T14:30:10Z
*** This issue has been marked as a duplicate of issue 16528 ***