Skip to content

Add lint against ptr-to-int transmutes in consts #87525

Closed
@RalfJung

Description

@RalfJung

We do not allow ptr-to-int casts in const context, so people might be tempted to do a transmute instead. This will not work, and if they ever actually test their code during CTFE they will get an error, but it might still be good to add an extra layer of defense here (since this is a rather odd corner of the language) and have a lint for this.

@jhpratt started working on this, here's a link.

Metadata

Metadata

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions