[Issue 22618] New: [REG2.078] Rejects valid depending on ordering of alias this and other alias
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 21 14:10:16 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22618
Issue ID: 22618
Summary: [REG2.078] Rejects valid depending on ordering of
alias this and other alias
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: johanengelen at weka.io
Testcase:
```
struct BaseBlock
{
void baseFoo()
{
}
}
template someMixin(alias Func)
{
}
struct BlockHandle(T)
{
T* block;
void foo()
{
block.baseFoo;
}
mixin someMixin!((BlockHandle!T self) {
self.foo;
});
}
struct ChildBlock
{
version (BUG)
{
alias Handle = BlockHandle!(typeof(this));
BaseBlock base;
alias base this;
}
else
{
BaseBlock base;
alias base this;
alias Handle = BlockHandle!(typeof(this));
}
}
```
Compilation without any flags succeeds.
But compilation with -version=BUG resuls in the error:
aliasbug.d(18): Error: no property `baseFoo` for type `aliasbug.ChildBlock*
Apparently the `alias this` is ignored during the evaluation of `alias Handle =
BlockHandle!(typeof(this));`, if the `alias this` is defined after the `alias
Handle = ...`.
The testcase succeeds with/without -version=BUG for dlang 2.077. (The bug was
detected as a regression between 2.093 and 2.097, but after dustmiting to the
testcase above it fails also with 2.093.)
--
More information about the Digitalmars-d-bugs
mailing list