Skip to content

fix(tests): use -pedantic-errors instead of a Clang-only warning name - #228

Merged
thiagoralves merged 1 commit into
developmentfrom
fix/gcc-pedantic-literal-warning
Aug 31, 2026
Merged

fix(tests): use -pedantic-errors instead of a Clang-only warning name#228
thiagoralves merged 1 commit into
developmentfrom
fix/gcc-pedantic-literal-warning

Conversation

@dcoutinho1328

Copy link
Copy Markdown
Contributor

What's broken

tests/integration/integer-literal-exact-cpp.test.ts compiles generated C++ with -Werror=implicitly-unsigned-literal, a Clang-only warning name. On real GCC (the Linux CI runner), g++ doesn't recognize it and aborts outright:

cc1plus: error: '-Werror=implicitly-unsigned-literal': no option '-Wimplicitly-unsigned-literal'

That fails all 7 tests in the file — not because the code under test is wrong, but because the compile never gets far enough to check it. It passes on macOS dev machines because g++ there is Apple Clang.

This isn't new: the same 7 tests failed identically on Linux CI for the last two developmentmain release merges (v0.6.3, v0.6.4) — both shipped anyway. Discovered while opening #227 (development → main for v0.6.5), which is currently red because of it.

The fix

Swap the Clang-only flag for -pedantic-errors. GCC's diagnostic for this case ("integer constant is so large that it is unsigned") has no -W name of its own — it's unconditional — so it can't be targeted with a named -Werror=. -pedantic-errors is the portable way to turn it into a hard error on both compilers.

Verification

Ran in a Node 22 + GCC 13.3.0 / Ubuntu 24.04 container matching the CI runner exactly (confirmed via the failing run's own "Operating System" log):

  • integer-literal-exact-cpp.test.ts: 7/7 passing (was 0/7).
  • Full suite: 93 files, 2322 passed, 7 skipped, coverage gate green.
  • npm run lint: 0 errors. npm run typecheck: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PQ239CtwGVnDMSeLA2Lx93

-Werror=implicitly-unsigned-literal is a Clang spelling; GCC has no
warning by that name and rejects it as an unknown option, aborting the
compile before it ever reaches the unsuffixed-literal check this test
exists to enforce. That has been failing 7 tests in this file on every
Linux CI run (including the last two development->main release merges,
v0.6.3 and v0.6.4) since the test predates this branch.

-pedantic-errors turns the same GCC diagnostic ("integer constant is so
large that it is unsigned") into a hard error and works on Clang too.

Verified in a Node 22 + GCC 13.3.0 / Ubuntu 24.04 container matching
the CI runner: the target test (7/7), the full suite (93 files, 2322
passed, 7 skipped, coverage gate green), lint and typecheck all pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PQ239CtwGVnDMSeLA2Lx93
@thiagoralves
thiagoralves merged commit 7fe0411 into development Aug 31, 2026
@thiagoralves
thiagoralves deleted the fix/gcc-pedantic-literal-warning branch August 31, 2026 18:38
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.

2 participants