Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportC: typedef C tag struct causes ImportC to emit erroneous "forward declared" struct definition. #20911

Open
LightBender opened this issue Feb 24, 2025 · 0 comments
Labels
Feature:ImportC Pertaining to ImportC support

Comments

@LightBender
Copy link
Contributor

LightBender commented Feb 24, 2025

The following struct in C:

//  bug.i
typedef struct tagTIME_STRUCT
{
        int   hour;
        int   minute;
        int   second;
} TIME_STRUCT;

Produces the following output snippet in ImportC in file bug.d:

...
	struct tagTIME_STRUCT
	{
		int hour = void;
		int minute = void;
		int second = void;
	}
	alias TIME_STRUCT = tagTIME_STRUCT;
	struct tagTIME_STRUCT;
...

The second "forward declared" struct declaration should never be present and causes a build error in DMD.

Command to get error: $dmd bug.i -Hf=bug.d -verrors=0 -main, compiling the resultant file then fails with duplicate struct tagTIME_STRUCT

@thewilsonator thewilsonator added the Feature:ImportC Pertaining to ImportC support label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ImportC Pertaining to ImportC support
Projects
None yet
Development

No branches or pull requests

2 participants