www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21691] New: premature mangleof can be accessed when pragma

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

          Issue ID: 21691
           Summary: premature mangleof can be accessed when pragma mangle
                    calls the function it's applied to
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

I did not hit this bug in the wild so I'm marking it as only a minor issue, but
found this when testing https://github.com/dlang/dmd/pull/12252:
```
pragma(mangle, getFoo())
string getFoo() 
{
    pragma(msg, getFoo.mangleof);
    return "foo";
}
pragma(msg, getFoo.mangleof);
```

Output:
 _D9onlineapp6getFooFZAya
 foo
It should raise a forward reference error, but instead a premature .mangleof is printed. --
Mar 08 2021