-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.10.0-dev.295+f19b5ecf4
Steps to Reproduce
This occurs when the AutoArrayHashMap key type is an enum with a single member and the value type is void.
This construct is unlikely to be seen in real-world code, but occurred in a test-case where the hashmap was part of a larger structure taking an enum type argument.
const std = @import("std");
test "alignment error" {
const E = enum { a };
var map = std.AutoArrayHashMap(E, void).init(std.testing.allocator);
defer map.deinit();
}The compile error disappears if a) another enum member is added, or b) a value type is specified.
Expected Behavior
Successful compilation
Actual Behavior
Fails with
build/lib/zig/std/multi_array_list.zig:19:25: error: alignment must be >= 1
bytes: [*]align(@alignOf(S)) u8 = undefined,
^
build/lib/zig/std/multi_array_list.zig:19:9: note: referenced here
bytes: [*]align(@alignOf(S)) u8 = undefined,
^
./repro.zig:5:44: note: referenced here
var map = std.AutoArrayHashMap(E, void).init(std.testing.allocator);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Type
Projects
Status
Uncategorized