Skip to content

Combining inline fn with .never_inline does not fail if the function takes comptime T: type parameter. #5995

@kliberty

Description

@kliberty

The documentation specifies that using @call( .{ .modifier = .never_inline}, ...) on an inline fn should fail at compile time. In the code example below, inline fn fiveXwithType(comptime T: type) does not fail to compile when called with .modifier = .never_inline.

Compiler Explorer shows that this call is actually inlined.
Uncommenting the second @call yields the expected compile failure.

Tested with trunk and v0.6.0.

extern var X: *volatile i32;

inline fn fiveXwithType(comptime T: type) void {
    X.* = 5;
}

inline fn fiveXwithArg(v: i32) void {
    X.* = 5;
}

export fn externalFun() void {
    @call(.{ .modifier = .never_inline}, fiveXwithType, .{i32});
    //@call(.{ .modifier = .never_inline}, zeroXwithArg, .{1});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions