dotnet / dotnet/fsharp

No compiler error when attempting to use voidptr as type argument

Open
#19,224 1 comment 0 reactions 0 assignees View on GitHub
Area-Compiler-CodeGen Bug
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Using `voidptr ` as a type argument does not cause a compiler error, even though it is invalid and causes a `BadImageFormatException` or `TypeLoadException` at runtime.

**Repro steps**

1. Use `voidptr` as a type argument, e.g:
```fs
let badList: voidptr list = []
printf "%A" badList
```
2. Compile.

**Expected behavior**

An error, preventing compilation. This happens in C# with `void*`.

**Actual behavior**

No compilation error, but errors at runtime.

**Known workarounds**

Don't try to use `voidptr` as a generic type argument.

**Related information**

* Operating system: Kubuntu 25.10
* .NET Runtime kind: .NET 10
* Editing Tools: JetBrains Rider 2025.3.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.