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