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

Elision Only types can't be reflected in MSVC > 16.28 #126

Open
chjanke opened this issue May 12, 2023 · 1 comment
Open

Elision Only types can't be reflected in MSVC > 16.28 #126

chjanke opened this issue May 12, 2023 · 1 comment

Comments

@chjanke
Copy link

chjanke commented May 12, 2023

MSVC implements mandatory copy elision in v16.29.

I have expected that copy elision also enables reflecting aggregates that are neither copyable nor movable.
Clang and GCC both successfully reflect such types, however MSVC fails to do so.

Minimal example to reproduce the issue: godbolt

As shown in the example, the aggregate can be returned from functions just fine through mandatory copy elision, and it is also classified as an aggregate and can be aggregate initialized as expected.
However MSVC fails, asking me to report the issue, so here it is.

@chjanke
Copy link
Author

chjanke commented May 25, 2023

This seems to be a compiler bug in msvc where the C++17 elision rules don't correctly work inside decltype.
Related report: https://developercommunity.visualstudio.com/t/C17-Guaranteed-Copy-Elision-does-not-a/10374637

A workaround for this is to declare the move constructor of your type private and not implement it.
The existence of the signature, or rather it not being explicitly deleted, is enough to make Boost.PFR work again.

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

No branches or pull requests

1 participant