Skip to content

incompatible function pointer types C error with uint vs csize_t #25617

@etan-status

Description

@etan-status

Nim Version

Nim Compiler Version 2.2.4 [MacOSX: arm64]
Compiled at 2025-12-29
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f7145dd
active boot switches: -d:release

Description

var
  a: proc (len: uint)
  b: proc (len: csize_t)

  c = a
c = b

Current Output

.......................................................................................................................
CC: test.nim
.../test.nim:6:87: error: incompatible function pointer types assigning to 'void (*)(NU, void *)' (aka 'void (*)(unsigned long long, void *)') from 'void (*)(size_t, void *)' (aka 'void (*)(unsigned long, void *)') [-Wincompatible-function-pointer-types]
    6 |         nimln_(6);      asgnRef((void**) (&c__test_u8.ClE_0), b__test_u7.ClE_0);        c__test_u8.ClP_0 = b__test_u7.ClP_0;    popFrame();}
      |                                                                                                          ^ ~~~~~~~~~~~~~~~~
1 error generated.

Expected Output

Some Nim level error that highlights the incompatibility of uint and csize_t, instead of a C error

Known Workarounds

Fix the code

Additional Information

% sw_vers
ProductName:		macOS
ProductVersion:		26.3.1
BuildVersion:		25D2128

% xcodebuild -version
Xcode 26.3
Build version 17C529

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions