[Issue 21691] New: premature mangleof can be accessed when pragma mangle calls the function it's applied to

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 8 21:02:12 UTC 2021


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 at puremagic.com
          Reporter: dkorpel at 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.

--


More information about the Digitalmars-d-bugs mailing list