mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Merge branch 'kristate-zig-backport-issue1883'
This commit is contained in:
commit
aee973829d
@ -5751,6 +5751,13 @@ void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_v
|
||||
}
|
||||
|
||||
void render_const_val_ptr(CodeGen *g, Buf *buf, ConstExprValue *const_val, ZigType *type_entry) {
|
||||
assert(type_entry->id == ZigTypeIdPointer);
|
||||
|
||||
if (type_entry->data.pointer.child_type->id == ZigTypeIdOpaque) {
|
||||
buf_append_buf(buf, &type_entry->name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (const_val->data.x_ptr.special) {
|
||||
case ConstPtrSpecialInvalid:
|
||||
zig_unreachable();
|
||||
|
||||
@ -1,6 +1,15 @@
|
||||
const tests = @import("tests.zig");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"compile log a pointer to an opaque value",
|
||||
\\export fn entry() void {
|
||||
\\ @compileLog(@ptrCast(*const c_void, &entry));
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:2:5: error: found compile log statement",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"duplicate boolean switch value",
|
||||
\\comptime {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user