www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24199] New: ImportC: generated .di file uses `struct` keyword

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

          Issue ID: 24199
           Summary: ImportC: generated .di file uses `struct` keyword when
                    referring to a type.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

// s.c
struct Foo {
    int x;
};

struct Foo foo(void);

when processed into a .di file:

// s.di
// D import file generated from 's.c'
extern (C)
{
        struct Foo
        {
                int x = void;
        }
        struct Foo foo(); // this is not valid D, remove the `struct`
}

--
Oct 24 2023