summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-09-09 10:46:47 +0300
committerGitHub <noreply@github.com>2024-09-09 09:46:47 +0200
commit7de4ace94908f515a98fbe6f3a4a022b6fa9e3f8 (patch)
tree99868927360692cf8de2400f3fd39da4d5162e3a /tests
parent6a5aa007010f90141199f3a4eb14ab85105ddac7 (diff)
downloadNim-7de4ace94908f515a98fbe6f3a4a022b6fa9e3f8.tar.gz
fix int32's that should be uint32 on BSD & OSX (#24078)
fixes #24076

As described in #24076, misannotating these types causes codegen errors.
Sources for the types are https://github.com/openbsd/src/blob/master/sys
for BSD and https://opensource.apple.com/source/Libinfo/Libinfo-391/ and
[_types.h](https://opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/_types.h.auto.html)
for OSX.
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/twronguidtype.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/stdlib/twronguidtype.nim b/tests/stdlib/twronguidtype.nim
new file mode 100644
index 000000000..25f834d8a
--- /dev/null
+++ b/tests/stdlib/twronguidtype.nim
@@ -0,0 +1,8 @@
+# issue #24076
+
+when defined(macosx) or defined(freebsd) or defined(openbsd) or defined(netbsd):
+  import std/posix
+  proc uid(x: uint32): Uid = Uid(x)
+  var y: uint32
+  let myUid = geteuid()
+  discard myUid == uid(y)