xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

Non-conformant testing of template-template-args c++ standard feature

Open mizvekov opened this issue 1 year ago • 1 comments

This project includes workarounds for the changes introduced in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html, which was adopted as a defect report and thus retroactively applies back to all language standards.

See here: https://github.com/xtensor-stack/xtensor/blob/d9c3782ed51027b2d00be3c26288b2f74e4dbe94/include/xtensor/xutils.hpp#L1022

The problem is that this workaround is testing for GCC specifically and C++17, excluding Clang.

GCC has included this change for a while, but it's only enabled by default in C++17 and above, but can be enabled and disabled freely with a flag as well.

Clang has never enabled it by default until now, deferring it to the flag only. This is changing with the next version, where it's going to be enabled in all language versions, and the flag becomes deprecated, to be removed in the version after that.

This means building this project is failing when this feature's enablement differs from default. With the next version of Clang, it's not going to work with the default there either.

Solution: replace above check with testing of standard feature macro: https://en.cppreference.com/w/cpp/feature_test#cpp_template_template_args

References: https://github.com/llvm/llvm-project/pull/89807 https://github.com/llvm/llvm-project/issues/91504

mizvekov avatar May 09 '24 20:05 mizvekov

There is another place that looks like a candidate for the same fix: https://github.com/xtensor-stack/xtensor/blob/d9c3782ed51027b2d00be3c26288b2f74e4dbe94/include/xtensor/xexpression_traits.hpp#L106

A user reported here that this also fixes a similar issue: https://github.com/llvm/llvm-project/pull/89807#issuecomment-2137453834

mizvekov avatar May 29 '24 17:05 mizvekov

This has been fixed in #2833.

JohanMabille avatar Mar 27 '25 01:03 JohanMabille