aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/1421.zig
blob: d6ea8a2bad45f329bc4ad47bf59fbd66d66d1e6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const std = @import("std");
const expect = std.testing.expect;
const builtin = @import("builtin");

const S = struct {
    fn method() std.builtin.Type {
        return @typeInfo(S);
    }
};

test "functions with return type required to be comptime are generic" {
    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
    const ti = S.method();
    try expect(@as(std.builtin.TypeId, ti) == std.builtin.TypeId.Struct);
}