www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23168] New: [DIP1000] return scope wrongly rewritten for


          Issue ID: 23168
           Summary: [DIP1000] return scope wrongly rewritten for structs
                    with no indirections
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Ajieskola gmail.com

Compile with dmd 2.100.0 and -preview=dip1000 switch.

struct Ptr
{  safe int* fun() return scope {return null;}
  //int* aRef; uncomment to compile

 safe int* use()
{ Ptr ptr;
  return ptr.fun;

The compiler detects that Ptr has no indirections, so it correctly judges
`return scope` as needless. However, instead of just removing it, it replaces
it with `return` attribute. This makes this code to wrongly fail to compile.

Jun 07 2022