Bug 23589 – [REG2.095] Purity check special case gives circular reference error.
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-12-28T20:27:57Z
Last change time
2023-01-01T06:25:16Z
Keywords
industry, pull, rejects-valid
Assigned to
No Owner
Creator
johanengelen
Comments
Comment #0 by johanengelen — 2022-12-28T20:27:57Z
The testcase below compiles with 2.094, but fails compilation with 2.095.
The regression is introduced by this PR: https://github.com/dlang/dmd/pull/12023 (introduces size check for the special case of zero-sized struct). Removing the size check (`sd.determineSize(v.loc);`) "fixes" the regression.
Testcase:
```
struct TemplStr(string Description_) {}
template A() {
bool member;
alias THIS = typeof(this);
static THIS staticInstance;
static asSize()
{
return staticInstance.member;
}
}
template B() {
enum cols = columns();
enum cols_two = cols;
TemplStr!(cols_two) tstr;
}
struct S
{
mixin A;
mixin B;
static string columns() {
auto dummy = &asSize;
return "as";
}
}
```
Comment #1 by dlang-bot — 2022-12-28T21:52:33Z
@ibuclaw created dlang/dmd pull request #14750 "fix Issue 23589 - [REG2.095] Purity check special case gives circular reference error" fixing this issue:
- fix Issue 23589 - [REG2.095] Purity check special case gives circular reference error
https://github.com/dlang/dmd/pull/14750
Comment #2 by dlang-bot — 2022-12-30T14:29:23Z
dlang/dmd pull request #14750 "fix Issue 23589 - [REG2.095] Purity check special case gives circular reference error" was merged into stable:
- df4670e4506c5f83bd35d9f330c420bec9baf163 by Iain Buclaw:
fix Issue 23589 - [REG2.095] Purity check special case gives circular reference error
https://github.com/dlang/dmd/pull/14750
Comment #3 by dlang-bot — 2023-01-01T06:25:16Z
dlang/dmd pull request #14765 "merge stable" was merged into master:
- 4b5a7826a74616e017698da79cb216a52b85775b by Iain Buclaw:
fix Issue 23589 - [REG2.095] Purity check special case gives circular reference error
https://github.com/dlang/dmd/pull/14765