-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Visual C++] Provide alternative to array designators. #28170
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
[Visual C++] Provide alternative to array designators. #28170
Conversation
@swift-ci please smoke test |
@swift-ci Please test Windows platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, I thought this was part of the standard. LGTM to fix the build, but maybe we should just use the fallback everywhere to ensure we stay C++ 14 compliant. I can do that in a follow-up if need be
I will let the Windows PR testing finish with this code. I want to check that my local results are valid in the CI machine. I can remove the non-standard implementation and re-submit later with a comment about why the strange construct. Also, if some C++ wizard knows a cleaner way to initialize a constexpr array, I would not mind learning about it. |
cbe9c10
to
14821c4
Compare
The Windows CI went beyond the failure point just fine. Re-submitted with the non-standard implementation removed. @swift-ci please smoke test |
It seem like Clang doesn't like this line:
Trying to work around that issue I'm also running into issues with "pointer to subject of temporary is not constexpr". I'm going to prepare a revert of my patch just in case. |
clang accepts
I'm not sure if MSVC will like that use of auto though... |
Gonna send that in a moment. I don't have the Windows machine at hand anymore, so I will trust that the CI will tell us if it works. |
14821c4
to
9cd1611
Compare
@swift-ci please smoke test |
(I will go to bed, so anyone, feel free to merge if everything is green) @swift-ci please test Windows platform |
https://ci-external.swift.org/view/Pull%20Request/job/swift-PR-windows/163/ is the CI job, but it haven't been linked to this PR for some reason. |
Even if they are supported in GCC and Clang, C99 array designators are not part of the current C++ standard (they will be in C++20), so they are not supported in Visual C++. This commit provides an alternative for Visual C++ (which should work in other compilers) which doesn't use array designators. I think Clang 10 will start printing a warning about this incorrect usage.
9cd1611
to
eb7a26d
Compare
I should have copy/pasted the solution provided, not try to type it from memory. Sigh. @swift-ci please smoke test |
@swift-ci please test Windows platform (https://ci-external.swift.org/view/Pull%20Request/job/swift-PR-windows/164/ because it doesn't seem to be linked) |
Merging this one. Seems to work OK in the three platforms. |
Even if they are supported in GCC and Clang, C99 array designators are
not part of the current C++ standard (they will be in C++20), so they
are not supported in Visual C++.
This commit provides an alternative for Visual C++ (which should work in
other compilers) which doesn't use array designators.
I think Clang 10 will start printing a warning about this incorrect
usage.
Introduced in #28052 and started breaking Windows CI in https://ci-external.swift.org/job/oss-swift-windows-x86_64/1899 (it was broken before, but this error starts in that one).