Skip to content

Type error during assignment of global variable #806

Closed
@nmeum

Description

@nmeum

Consider the following minimal example code:

static _Nt_array_ptr<const char> mystr;

void
myfunc(const char *str : itype(_Nt_array_ptr<const char>))
{
	mystr = str;
}

int
main(void)
{
	myfunc("foo");
}

I would expect this to compile correctly, unfortunately it doesn't:

test.c:6:8: error: assigning to '_Nt_array_ptr<const char>' from incompatible type 'const char *'
        mystr = str;
              ^ ~~~
1 error generated.

From my understanding of the Checked C language specification, I was under the assumption that checked pointer types and bounds-safe interfaces are assignment compatible. Either this is not the case, i.e. my understanding of the specification is incorrect, or this is a bug in the compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions