Skip to content

Inconsistent behavior in safe checking of conversion to void #3373

Open
@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Walter Bright reported this on 2024-11-18T18:36:48Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24866

CC List

  • Richard (Rikki) Andrew Cattermole

Description

```
@safe:

struct T { int* a,b,c; }

void bar(void[24]);
void gee(void*);

void test() {
    static T t;
    gee(&t);              // no error
    bar(cast(void[24])t); // cast from `T` to `void[24]` not allowed in safe code
}
```
Both should be allowed or both should error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions