The module std.os.linux contains a declaration of pub const syscall7 = syscall_bits.syscall7;, so @hasDecl(std.os.linux, "syscall7") is true.
On my platform, syscall_bits.syscall7 actually evaluates to @import("linux/x86_64.zig").syscall7, and this module does not contain a syscall7, so @field(std.os.linux, "syscall7") leads to a compile error.
As a result, I cannot compile a program to iterate the declarations of a type. I have to manually exclude all functions like syscall7 from the loop. Is there any reliable method to query the existence of a function?
const std = @import("std");
pub fn main() !void {
std.debug.print("syscall0:\n", .{});
std.debug.print("\thas decl: {}\n", .{@hasDecl(std.os.linux, "syscall0")});
std.debug.print("\thas field: {}\n", .{@hasField(std.os.linux, "syscall0")});
std.debug.print("\thas fn: {}\n", .{std.meta.hasFn(std.os.linux, "syscall0")});
std.debug.print("syscall7:\n", .{});
std.debug.print("\thas decl: {}\n", .{@hasDecl(std.os.linux, "syscall7")});
std.debug.print("\thas field: {}\n", .{@hasField(std.os.linux, "syscall7")});
// Comment the following line to get a compile error
// std.debug.print("{}\n", .{std.meta.hasFn(std.os.linux, "syscall7")});
}