Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

syntax error: 'cv-qualifier' (TypeInfo type_to_cdecl for const structs containing array) #70

@uucidl

Description

@uucidl

With the following:

struct FooArray
{
    x : int[3];
}

struct FooWithConstArray
{
    array : FooArray const*;
}


func test_const_members() {
    foo := FooWithConstArray{};
    #assert(foo.array.x[0] == 0);
}

Then when TypeInfo gets written, ion generates:

    [53] = &(TypeInfo){TYPE_CONST, .size = sizeof(int (const [3])), .align = alignof(int (const [3])), .base = TYPEID(50, TYPE_ARRAY, int [3])},

the int (const [3]) is not parsed as a valid type expression

Somehow the type entry seems invalid to me, as all arrays in C are const. So the type info should probably not be generated at all (TYPE_CONST with base TYPE_ARRAY)

type_to_cdecl could be instrumented to assert that a TYPE_CONST should not be an array

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions