Bug 22420 – [REG2.098] Apparent CTFE regression wrt. alias this
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-18T16:35:00Z
Last change time
2021-10-21T21:39:42Z
Keywords
industry, pull
Assigned to
No Owner
Creator
kinke
Comments
Comment #0 by kinke — 2021-10-18T16:35:00Z
Caused or at least triggered by https://github.com/dlang/dmd/pull/13137. Reduced by Iain (thanks a lot!):
```
struct File
{
~this()
{
}
File impl()
{
return File.init;
}
alias impl this;
}
struct Variable
{
this(File)(File) { }
this(File)(File[]) { }
}
Variable wrapFunctionReturn(alias handler)(Variable params)
{
return Variable(handler(params));
}
void registerFile()
{
wrapFunctionReturn!((Variable) {
return File.init;
})(Variable.init);
}
```
Compiles fine with DMD v2.097.2; v2.098.0 and current stable fail with:
bla.d(19): Error: variable `params` cannot be read at compile time
bla.d(19): called from here: `__lambda1(params)`
bla.d(23): Error: template instance `current.registerFile.wrapFunctionReturn!((Variable)
{
return File.init;
}
)` error instantiating
Comment #1 by dlang-bot — 2021-10-18T23:37:24Z
@BorisCarvajal created dlang/dmd pull request #13198 "Fix Issue 22420 - [REG2.098] Apparent CTFE regression wrt. alias this" fixing this issue:
- Fix Issue 22420 - [REG2.098] Apparent CTFE regression wrt. alias this
https://github.com/dlang/dmd/pull/13198
Comment #2 by dlang-bot — 2021-10-19T08:48:55Z
dlang/dmd pull request #13198 "Fix Issue 22420 - [REG2.098] Apparent CTFE regression wrt. alias this" was merged into stable:
- 8f9a30f4f74359d80010ad6a671f5ddd8ead77e0 by Boris Carvajal:
Fix Issue 22420 - [REG2.098] Apparent CTFE regression wrt. alias this
https://github.com/dlang/dmd/pull/13198
Comment #3 by dlang-bot — 2021-10-21T21:39:42Z
dlang/dmd pull request #13209 "Merge stable into master" was merged into master:
- 7d417865980698a555b129db54a4cd29b55ceb98 by Boris Carvajal:
Fix Issue 22420 - [REG2.098] Apparent CTFE regression wrt. alias this (#13198)
https://github.com/dlang/dmd/pull/13209