Bug 19792 – typeof expression in parameter list appears to select wrong overload

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-04-07T14:31:12Z
Last change time
2024-12-13T19:02:54Z
Assigned to
No Owner
Creator
asumface
Moved to GitHub: dmd#19552 →

Comments

Comment #0 by asumface — 2019-04-07T14:31:12Z
The following code fails since 2.085.x: struct Node // dummy struct { int box; } Node node; auto box() @property { return node.box; } auto anythingButBox(typeof(box) arg) @property { return node.box = arg; } auto box(typeof(box()) arg) @property { return node.box = arg; } auto box(typeof(box) arg) @property { return node.box = arg; } The definition auto box(typeof(box()) arg) @property fails with: Error: forward reference to template box The definition auto box(typeof(box) arg) @property fails with: Error: forward reference to template box Error: forward reference to template box (That's right, twice!) If the definition of auto box() @property is moved below all others, previous versions of dmd segfault, I therefore conclude that this is related to issue #19717. auto box(typeof(box()) arg) @property then fails with: Error: forward reference to template box Error: none of the overloads of box are callable using argument types (), candidates are: onlineapp.box(typeof(box()) arg) onlineapp.box(typeof(box) arg) onlineapp.box() (the overload error is contradicting itself here!) auto box(typeof(box) arg) @property with: Error: forward reference to template box Error: circular typeof definition
Comment #1 by robert.schadek — 2024-12-13T19:02:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19552 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB