Skip to content

Check and use constexpr for fns and constructors #2925

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

Merged
merged 3 commits into from
Jun 21, 2020

Conversation

9prady9
Copy link
Member

@9prady9 9prady9 commented Jun 5, 2020

Fixes #2924

umar456
umar456 previously approved these changes Jun 10, 2020
@9prady9
Copy link
Member Author

9prady9 commented Jun 15, 2020

Don't merge this yet, looks like just having this AF_CONSTEXPR is not sufficient because MSVC added some features incrementally - especially the support for multiple return statements and initializing non constexpr variables inside a constexpr function body.

@9prady9 9prady9 force-pushed the check_constexpr_use branch 3 times, most recently from 1e46b17 to 5e1b722 Compare June 16, 2020 22:31
@9prady9 9prady9 force-pushed the check_constexpr_use branch from f1299ab to 876e27f Compare June 20, 2020 06:16
* AF_CONSTEXPR expands to nothing if constexpr support is not available.

* Replace CONSTEXPR_DH with AF_CONSTEXPR and __DH__ in
  `src/backend/common/half.hpp`

* Removed AF_CONSTEXPR where it is invalid in half.hpp
@9prady9 9prady9 force-pushed the check_constexpr_use branch from 876e27f to 90b760b Compare June 20, 2020 11:20
* Adds the Zc:__cplusplus flag to cuda builds for MSVC if the flag is available.
the cuda_fp16 header does not define the default constructor for __half as
"= default" and that prevents the __half struct to be used in a constexpr
expression

* For older versions of MSVC we define the __cplusplus macro before and
after the inclusion of cuda_fp16.h header.

* Define the AF_CONSTEXPR macro for NVRTC compilation
@umar456 umar456 merged commit 0c53e09 into arrayfire:master Jun 21, 2020
@9prady9 9prady9 deleted the check_constexpr_use branch June 24, 2020 07:13
@umar456 umar456 mentioned this pull request Jun 27, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to build afopencl x64 target on MSVS 2017
2 participants