Bug 22618 – [REG2.078] Rejects valid depending on ordering of alias this and other alias

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-12-21T14:10:16Z
Last change time
2024-12-13T19:20:01Z
Keywords
industry, rejects-valid
Assigned to
No Owner
Creator
johanengelen
Moved to GitHub: dmd#20027 →

Comments

Comment #0 by johanengelen — 2021-12-21T14:10:16Z
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.)
Comment #1 by robert.schadek — 2024-12-13T19:20:01Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20027 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB