-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
zig comptime memoization broken with comptime slices #7948
Copy link
Copy link
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioruse caseDescribes a real use case that is difficult or impossible, but does not propose a solution.Describes a real use case that is difficult or impossible, but does not propose a solution.
Milestone
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioruse caseDescribes a real use case that is difficult or impossible, but does not propose a solution.Describes a real use case that is difficult or impossible, but does not propose a solution.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following code will cause the compiler to go into an infinite function instantiation loop when compiling with
zig build-exe bug.zig:The problem here is that when Zig checks whether
comptimeFun("foo")has already been instantiated, it's not seeing that slices with the same contents are equivalent. So even thoughcomptimeFunis always called with the same comptime string"foo", it doesn't see them as equivalent so it just keeps instantiating them forever.