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

Fix bugs and improve that about HPX_HAVE_CXX11_AUTO_RETURN_VALUE of CMake. #2821

Merged
merged 6 commits into from Aug 14, 2017

Conversation

taeguk
Copy link
Member

@taeguk taeguk commented Aug 12, 2017

This is related to #2720.

  1. When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.
  2. The auto return value is C++14 feature. So, renaming to HPX_HAVE_CXX14_AUTO_RETURN_VALUE seems better.

@hkaiser @gentryx Can you review this?

Added later)

  1. Add feature test.
  2. The formal naming of auto return value is 'return type deduction'. So, renaming to HPX_HAVE_CXX14_RETURN_TYPE_DEDUCTION seems better.
  3. Add cmake known feature test.

When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.
@hkaiser
Copy link
Member

hkaiser commented Aug 12, 2017

1.When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.

I think it should be ON for conforming compilers. I agree, this is unusual, but we couldn't come up with a better name. We could however rename the PP constant to HPX_CXX11_NO_AUTO_RETURN_VALUE_DEFAULT and flip the flag.

Rename HPX_HAVE_CXX11_AUTO_RETURN_VALUE to HPX_HAVE_CXX14_AUTO_RETURN_VALUE.

The feature in question is a C++11 feature. C++11 allows for using auto on a function without specifying an explicit return type if the function consists of only a single return statement allowing for the compiler to deduce the return type from this.

@taeguk
Copy link
Member Author

taeguk commented Aug 12, 2017

The feature in question is a C++11 feature. C++11 allows for using auto on a function without specifying an explicit return type if the function consists of only a single return statement allowing for the compiler to deduce the return type from this.

@hkaiser Does the feature is a C++11 feature really?? But, I got compile errors related to auto return value with C++11... (https://gist.github.com/taeguk/a9a37590471f0c30a706ca6aea0a392f)
As I think, maybe you confused it with deduced return type for "lambda". (https://isocpp.org/wiki/faq/cpp14-language#generalized-return)

@hkaiser
Copy link
Member

hkaiser commented Aug 12, 2017

@taeguk, you're right - sorry for the confusion on my end. So this is a C++14 facility after all ...

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@gentryx
Copy link
Member

gentryx commented Aug 12, 2017

In this case we might want an overridable configure time test to detect whether this setting should on or off. We had one in 8599ce3

@taeguk
Copy link
Member Author

taeguk commented Aug 12, 2017

@gentryx Do you mean adding feature tests for auto return value?

@taeguk
Copy link
Member Author

taeguk commented Aug 13, 2017

Wait. What's the problem with CUDA?
Is it insufficient to use just feature test for detecting whether auto return value can be used?

@hkaiser
Copy link
Member

hkaiser commented Aug 13, 2017

Is it insufficient to use just feature test for detecting whether auto return value can be used?

We run the feature tests not for NVCC but for the compiler used by NVCC to generate the code. NVCC itself is just a preprocessor which generates C code from the C++ input.

@taeguk taeguk changed the title Fix a bug which related to HPX_HAVE_CXX11_AUTO_RETURN_VALUE in CMakeLists.txt. Fix bugs and improve that about HPX_HAVE_CXX11_AUTO_RETURN_VALUE of CMake. Aug 13, 2017
@gentryx
Copy link
Member

gentryx commented Aug 13, 2017

@taeguk Yes, that's what I meant.

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.

None yet

3 participants