Skip to content

Error message when mis-matching different srtucts from c #17760

Description

@0x5247

Zig Version

0.12.0-dev.409+48e2ba3b3

Steps to Reproduce and Observed Output

Instead of just displaying the name of the type, it shows the whole path.

cVect.h

typedef struct Vector2
{
    int x;
    int y;
} Vector2;

typedef struct Vector2f
{
    float x;
    float y;
} Vector2f;

main.zig

const c = @cImport({
    @cInclude("cVect.h");
});

pub fn main() void {
    const foo: c.Vector2 = c.Vector2f{
        .x = 400,
        .y = 400,
    };
    _ = foo;
}

This is the error message I'm getting.

error: expected type 'C:.AAA.temp.zig-cache.o.84418c0ec09dd5fa20a25264f03a22fe.cimport.struct_Vector2',
found 'C:.AAA.temp.zig-cache.o.84418c0ec09dd5fa20a25264f03a22fe.cimport.struct_Vector2f'

Expected Output

To be honest that information is a bit useful but I think it would be better if it only shows the name of the type.

error: expected type Vector2, found Vector2f

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messageThis issue points out an error message that is unhelpful and should be improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions