D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22933 - importC: goto skips declaration of variable
Summary: importC: goto skips declaration of variable
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ImportC, pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2022-03-25 12:45 UTC by duser
Modified: 2022-03-29 19:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description duser 2022-03-25 12:45:12 UTC
void fn()
{ 
	goto L;
	int x = 1;
	L:
	return;
}

Error: `goto` skips declaration of variable `test.fn.x` at test.c(4)

could this be allowed in importC? other compilers accept it when compiling C but not C++
Comment 1 Dlang Bot 2022-03-29 06:16:52 UTC
@WalterBright created dlang/dmd pull request #13913 "fix Issue 22933 - importC: goto skips declaration of variable" fixing this issue:

- fix Issue 22933 - importC: goto skips declaration of variable

https://github.com/dlang/dmd/pull/13913
Comment 2 Dlang Bot 2022-03-29 19:26:52 UTC
dlang/dmd pull request #13913 "fix Issue 22933 - importC: goto skips declaration of variable" was merged into master:

- cd51b32e3c452e3a366430ed22ff7e006483dc9e by Walter Bright:
  fix Issue 22933 - importC: goto skips declaration of variable

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