[Issue 24670] New: importC: .di generation does not place parentheses around const struct return types
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Jul 21 13:25:39 UTC 2024
    
    
  
https://issues.dlang.org/show_bug.cgi?id=24670
          Issue ID: 24670
           Summary: importC: .di generation does not place parentheses
                    around const struct return types
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: michaelate at gmail.com
Created attachment 1915
  --> https://issues.dlang.org/attachment.cgi?id=1915&action=edit
I was able to add 4 lines to compiler/src/dmd/hdrgen.d to fix the problem. But
I don't know if that fix is complete or has bad side-effects. (never worked
with dmd code base before)
C-code:
struct S
{
  int x;
};
const struct S fun(int y);
.di file:
//...
const S fun(int y);
//...
The above code doesn't compile. It should be instead:
//...
const (S) fun(int y);
//...
--
    
    
More information about the Digitalmars-d-bugs
mailing list