Skip to content

[diff.expr] Unmentioned incompatibility with C about pointer indirection CWG2875 #5506

Open
@frederick-vs-ja

Description

@frederick-vs-ja

These usages of pointer indirection are explicitly allowed in C via WG14 N721, but seemly not allowed in C++.

int* p = &(*((int*)0)); // undefined behavior in C++, well-defined in C (DR076/N721)
int a[10];
int* q = &a[10];        // undefined behavior in C++, well-defined in C (DR076/N721)

Should we mention them in [diff.expr]?

Metadata

Metadata

Assignees

No one assigned

    Labels

    cwgIssue must be reviewed by CWG.not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions