Files
Nim/tests/ccgbugs
ringabout 056eeeae30 fixes #25931; type N {.importc: "const void *".} = pointer creates order-dependent compilation failure (#25936)
fixes #25931

This fix addresses bug #25931 — a signature hash collision with
importc-aliased pointer/cstring types.
The problem: In compiler/sighashes.nim, the hashType procedure
canonicalizes types for signature hashing. Integral types
(tyInt..tyUInt64, etc.) were excluded from canonicalization so that
types like pid_t (an importc alias) keep their backend spelling. But
pointer and cstring types with importc annotations were not excluded —
meaning a type like:
type N {.importc: "const void *".} = pointer
...would be collapsed to just pointer in the signature hash, causing
collisions when N and pointer are both used in procedure types within
the same compilation unit.
The fix (compiler/sighashes.nim:193): Adds tyPointer and tyCstring to
the list of types that skip canonicalization, right alongside the
integral types. The comment is updated to clarify this applies to
"builtin scalar-ish / pointer-like types".
The test (tests/ccgbugs/tsighash_typename_regression.nim:33-42): Adds a
regression test exercising the exact scenario — an importc pointer alias
used in both an object field type and a proc parameter type.
2026-06-25 10:19:13 +02:00
..
2018-08-12 20:43:30 +02:00
2018-03-23 13:28:22 +01:00
2021-11-12 11:19:24 +01:00
2021-02-08 09:46:07 +01:00
2018-12-11 21:23:22 +01:00
2018-12-11 21:23:22 +01:00
2018-09-28 09:59:45 +02:00
2019-05-06 09:34:03 +02:00
2021-01-11 18:02:32 +01:00
2021-09-14 19:40:42 +02:00
2020-11-18 07:56:31 +00:00
2021-03-02 19:41:55 +08:00
2019-11-05 11:05:46 +01:00
2015-04-11 10:01:13 +02:00
2016-08-09 14:16:26 +02:00
2024-12-13 19:30:53 +08:00
2016-06-02 17:23:39 +02:00
2022-09-23 13:05:05 +02:00
2021-09-14 19:39:55 +02:00
2016-09-07 08:29:45 +02:00
2018-12-11 21:23:22 +01:00
2022-09-23 13:05:05 +02:00
2021-01-22 13:14:28 +01:00
2021-03-11 14:03:25 +01:00
2016-01-30 15:45:45 +01:00
2020-11-26 20:00:31 +01:00
2022-09-23 13:05:05 +02:00
2019-06-26 23:15:58 +02:00
2017-02-09 01:16:43 +01:00
2015-03-24 23:07:19 +01:00
2017-11-19 00:37:36 +01:00
2018-03-16 15:32:01 +01:00
2024-11-21 23:50:49 +08:00
2016-03-29 21:44:42 +02:00
2019-05-05 16:08:16 +02:00
2016-07-19 15:40:21 +02:00
2016-04-19 12:10:48 +02:00
2015-10-06 15:51:00 +02:00
2017-02-26 17:41:00 +01:00
2016-08-24 11:48:21 +02:00
2019-05-10 11:43:58 +02:00
2019-05-06 09:34:03 +02:00
2019-05-06 09:34:03 +02:00
2019-05-06 09:34:03 +02:00
2019-05-06 09:34:03 +02:00
2019-05-06 09:34:03 +02:00