Thread overview
[Issue 24280] ImportC: forward reference error when compiling multiple files
Dec 12, 2023
Dennis
Dec 26, 2023
Walter Bright
Dec 27, 2023
Walter Bright
Dec 27, 2023
Walter Bright
Dec 27, 2023
Walter Bright
Dec 27, 2023
Dlang Bot
Dec 27, 2023
Dlang Bot
December 12, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

--- Comment #1 from Dennis <dkorpel@live.nl> ---
Another example: (not sure if it's the same bug)

a.c
```C
typedef struct {} Slice;
struct Lang
{
    Slice *slices;
};
```

b.c
```C
typedef struct {} Slice;

struct Lang
{
    Slice *slices;
};

void langmap(struct Lang *self)
{
    Slice slice = *self->slices;
}
```

```
dmd a.c // works
dmd b.c // works
dmd b.c a.c // works
dmd a.c b.c // fails:
b.c(11): Error: cannot implicitly convert expression `*(*self).slices` of type
`__tag2` to `__tag3`
```

--
December 26, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
The source of the trouble is dmd assigns each type a unique "deco" string. C structs defined in different .c files are considered to be the same if they have the same "deco" name. But since they are sometimes assumed to be different types because they are in different modules, confusion appears.

Not sure how to fix it yet.

--
December 27, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24303

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Dennis from comment #1)
> Another example: (not sure if it's the same bug)

This will require additional work, so refiled it as a separate issue:

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

--
December 27, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC

--
December 27, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--
December 27, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #15954 "fix Issue 24280 - ImportC: forward reference error when compiling mul…" fixing this issue:

- fix Issue 24280 - ImportC: forward reference error when compiling multiple files

https://github.com/dlang/dmd/pull/15954

--
December 27, 2023
https://issues.dlang.org/show_bug.cgi?id=24280

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15954 "fix Issue 24280 - ImportC: forward reference error when compiling mul…" was merged into master:

- e590fba9d81c6060f806a52c11c030161780484d by Walter Bright:
  fix Issue 24280 - ImportC: forward reference error when compiling multiple
files

https://github.com/dlang/dmd/pull/15954

--