From 8e06fbc149d0bc13679cdabeca03327ec9d8563f Mon Sep 17 00:00:00 2001 From: Daniel Coutinho <60111446+dcoutinho1328@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:17:49 -0300 Subject: [PATCH] fix(tests): use -pedantic-errors instead of a Clang-only warning name -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 Claude-Session: https://claude.ai/code/session_01PQ239CtwGVnDMSeLA2Lx93 --- tests/integration/integer-literal-exact-cpp.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/integer-literal-exact-cpp.test.ts b/tests/integration/integer-literal-exact-cpp.test.ts index ea751b0..ab5d29d 100644 --- a/tests/integration/integer-literal-exact-cpp.test.ts +++ b/tests/integration/integer-literal-exact-cpp.test.ts @@ -12,6 +12,13 @@ * -Werror is deliberate: `18446744073709551615` without the `ULL` suffix is a * GCC extension that warns rather than fails, and a warning is exactly the * failure mode this test exists to catch. + * + * `-pedantic-errors`, not a named `-Werror=`: GCC emits this diagnostic + * ("integer constant is so large that it is unsigned") unconditionally, with + * no `-W` name of its own to target — `-Werror=implicitly-unsigned-literal` + * is a Clang-only spelling that GCC rejects outright as an unknown option, + * aborting the compile before it reaches the check. `-pedantic-errors` is + * the portable way to turn this specific warning into a hard error on both. */ import { describe, it, expect, beforeAll, afterAll } from "vitest"; @@ -50,7 +57,7 @@ describeIfGpp("64-bit integer literals — generated C++", () => { testName, // An unsuffixed `18446744073709551615` is a GCC *extension* that warns // rather than fails, so the warning has to be the failure here. - extraFlags: ["-Werror=implicitly-unsigned-literal", "-Werror=overflow"], + extraFlags: ["-pedantic-errors", "-Werror=overflow"], mainCode: `#include \n\nint main() {\n using namespace strucpp;\n${mainBody}\n return 0;\n}\n`, }); }