D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23128 - Attributes inference breaks down with cycles
Summary: Attributes inference breaks down with cycles
Status: RESOLVED DUPLICATE of issue 16528
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-20 12:35 UTC by kinke
Modified: 2022-10-03 14:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kinke 2022-05-20 12:35:01 UTC
```
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 Dennis 2022-10-03 14:30:10 UTC

*** This issue has been marked as a duplicate of issue 16528 ***