www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19792] New: Rtypeof expression in parameter list appears to

https://issues.dlang.org/show_bug.cgi?id=19792

          Issue ID: 19792
           Summary: Rtypeof expression in parameter list appears to select
                    wrong overload
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: asumface gmail.com

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


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

--
Apr 07 2019