Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant is broken on MSVC #364

Closed
chiphogg opened this issue Dec 18, 2024 · 0 comments · Fixed by #365
Closed

Constant is broken on MSVC #364

chiphogg opened this issue Dec 18, 2024 · 0 comments · Fixed by #365
Labels
⬇️ affects: code (implementation) Affects implementation details of the code 📁 kind: bug Something isn't working correctly, or there's a mistake 💪 effort: tiny A trivial change
Milestone

Comments

@chiphogg
Copy link
Contributor

Discovered in this comment (microsoft/vcpkg#42679 (comment)). We can easily reproduce by adding a test case involving Constant to our MSVC test file.

@chiphogg chiphogg added 📁 kind: bug Something isn't working correctly, or there's a mistake 💪 effort: tiny A trivial change ⬇️ affects: code (implementation) Affects implementation details of the code labels Dec 18, 2024
@chiphogg chiphogg added this to the 0.4.1 milestone Dec 18, 2024
chiphogg added a commit that referenced this issue Dec 18, 2024
Some comments on the vcpkg PR to upgrade Au to 0.4.0 made me suspicious
that we lacked coverage here.  I added a test case, and sure enough, it
[broke].

What's happening here is that MSVC is being _extremely persnickety_
about what we pass to a `static_assert`.  We are passing a function
parameter, which _in the general case_ might be a **runtime** value;
hence, inappropriate for `static_assert`.

What MSVC doesn't know is that `OtherUnit` is a [monovalue type], so it
can only ever have one possible value, and therefore that value _is_
knowable at compile time.  That said, since it _is_ a monovalue type,
that means that it's safe to replace the instance `u` with an ad hoc
construction of the type name, `OtherUnit{}`.  This appeases MSVC.

Helps #364: we'll go over every other `static_assert` before closing.

[broke]:
https://github.com/aurora-opensource/au/actions/runs/12395185495/job/34600303870
[monovalue type]:
https://aurora-opensource.github.io/au/main/reference/detail/monovalue_types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⬇️ affects: code (implementation) Affects implementation details of the code 📁 kind: bug Something isn't working correctly, or there's a mistake 💪 effort: tiny A trivial change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant