Skip to content

fix const-correctness of ConstantFlag::operator-> - #190

Merged
Taywee merged 1 commit into
Taywee:masterfrom
metsw24-max:constant-flag-arrow-const
Jul 17, 2026
Merged

fix const-correctness of ConstantFlag::operator->#190
Taywee merged 1 commit into
Taywee:masterfrom
metsw24-max:constant-flag-arrow-const

Conversation

@metsw24-max

Copy link
Copy Markdown
Contributor

Broken operator-> on ConstantFlag

The arrow operator is a const member yet returns &value as a plain T*; inside a const method that address has type const T*, so the conversion is ill-formed and any constantFlag->member fails to compile. It stayed hidden because this is the only operator-> on the class and the shipped test only reaches Get() through a ConstantFlag pointer, so the member operator is never instantiated.

Every other value type here already pairs a mutable T* overload with a const const T* one, and a constant only needs the const form, so returning const T* lines it up with the rest. The test now reaches into a struct-typed constant through the arrow, which fails to build on master and passes with the change.

@Taywee

Taywee commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Good call, and good fix. It makes sense to me.

Thanks for the PR.

@Taywee
Taywee merged commit 216c54a into Taywee:master Jul 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants