Skip to content

[Clang][C++26] Clang overly generalizes the change in P3144R2 to pointers to incomplete enumeration types #99278

@frederick-vs-ja

Description

@frederick-vs-ja

Despite the title being "Deleting a Pointer to an Incomplete Type Should be Ill-formed", P3144R2 only invalidated deleting pointers to incomplete class types.

So, currently the following definition is supposed to be well-formed. But Clang currently rejects it (Godbolt link).

enum E {
    zero = decltype(delete static_cast<E*>(nullptr), 0){} // E is incomplete here
};

Not sure whether the standard or Clang should be fixed. As it's already very tricky to attempt to delete a pointer to an incomplete enumeration type, a CWG issue might be wanted to reject such delete-expressions.

Edit: CWG2925 was closed as NAD, so presumably Clang should be fixed.

Metadata

Metadata

Assignees

Labels

c++26clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions