aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/struct_name.zig
blob: 083c94f77915db2db41918f32ddee53616bf17dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const std = @import("std");

pub fn main() void {
    const Foo = struct {};
    std.debug.print("variable: {s}\n", .{@typeName(Foo)});
    std.debug.print("anonymous: {s}\n", .{@typeName(struct {})});
    std.debug.print("function: {s}\n", .{@typeName(List(i32))});
}

fn List(comptime T: type) type {
    return struct {
        x: T,
    };
}

// exe=succeed