www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24670] New: importC: .di generation does not place

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 puremagic.com
          Reporter: michaelate 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);
//...

--
Jul 21