Skip to content

Fix Issue 23226 - ImportC: allow single-argument _Static_assert(expr) - #23406

Merged
thewilsonator merged 2 commits into
dlang:masterfrom
AayushMainali-Github:fix-23226-importc-single-arg-static-assert
Jul 17, 2026
Merged

Fix Issue 23226 - ImportC: allow single-argument _Static_assert(expr)#23406
thewilsonator merged 2 commits into
dlang:masterfrom
AayushMainali-Github:fix-23226-importc-single-arg-static-assert

Conversation

@AayushMainali-Github

Copy link
Copy Markdown
Contributor

Summary

  • ImportC now accepts C23's single-argument _Static_assert(expr) in addition to the existing _Static_assert(expr, "msg") form.
  • Message parsing is skipped unless a comma follows the constant-expression; a missing message builds StaticAssert with a null msgs array (same as D's static assert).
  • Adds compilable/fail_compilation coverage and a changelog entry.

Fixes #23226

Test plan

  • make -j$(nproc) (compiler + druntime rebuild)
  • ./run.d compilable/test23226.c fail_compilation/test23226.c
  • Spot-check existing ImportC _Static_assert tests still pass (failcstuff1.c, test24594.c)

@dkorpel dkorpel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the test cases to the existing ones instead of a new file

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

DMD perf check

Metric Base PR delta
compile hello.d (instr) 216.3 M 216.3 M 0.00%
compile hello.d -O (instr) 234.9 M 234.9 M 0.00%
dmd binary size (stripped) 6.86 MB 6.86 MB 0.00%
hello binary size 0.72 MB 0.72 MB 0.00%
peak RSS (compile hello.d) 46 MB 46 MB -0.12%

@AayushMainali-Github

Copy link
Copy Markdown
Contributor Author

Add the test cases to the existing ones instead of a new file

Moved the tests into testcstuff1.c / failcstuff3.c.

@thewilsonator
thewilsonator merged commit a071130 into dlang:master Jul 17, 2026
40 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportC C23: single-argument _Static_assert(expr)

3 participants