Open ssmid opened 10 months ago
Debug build has an LLVM error:
LLVM Emit Object... error(llvm): failed verification of LLVM module:
Global is external, but doesn't have external or weak linkage!
ptr @a.predict_fun
I have a rough implementation of the desired behavior. I will be submitting a PR for this soon.
The listed "expected behavior" here is not correct. Holding a pointer to an inline function is perfectly semantically valid: the bug here is that this pointer, via a @ptrCast
, is permitted to become runtime-known. The same bug can be triggered by e.g. casting *type
to *anyopaque
.
A satisfactory solution to this bug will require introducing the concept of a comptime-only value of a runtime-valid type, and appropriate enforcement.
Zig Version
0.12.0-dev.1871+e426ae43a
Steps to Reproduce and Observed Behavior
This causes a linker error:
Use case where this is an issue:
Expected Behavior
~The compiler throws an error when creating a reference (
&
) to a function that is marked asinline
.~ See mlugg's answer below.