-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
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.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.translate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)
Milestone
Description
static void function2(int *a) {
const int *b = a;
}
static void function(const int *a) {
function2((int *)a);
}
const a: c_int = 0;
function(&a);
/home/tdeo/.cache/zig/stage1/o/.../cimport.zig:7:15: error: cast discards const qualifier
function2(@ptrCast([*c]c_int, @alignCast(@alignOf(c_int), a)));
Motivation: Wayland add_listener functions cast their struct of function pointer arguments to void (**)(void)
before passing them to another function, which then stores it in a const field and never modifies through it.
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.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.translate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)