Skip to content

Unchecked function assigned to safe typedef #719

Open
@kyleheadley

Description

@kyleheadley

In this simplification of a vsftpd error:

typedef void (*fp)(int *i); // given checked type

void simplefunc(int *i) {
  i = (int*)1; // unsafe - function will not be _Checked
}

void test(void) {
  fp func = simplefunc; // fail compilation: assign unchecked to checked
}

3C completes but clang won't accept the function pointer initialization in test. If simplefunc were checked, or even declared but undefined, clang would accept it. This may be another case for having an unchecked variant of a typedef (see #389).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions