mpusz / mp-units

The quantities and units library for C++
https://mpusz.github.io/mp-units/
MIT License
1.07k stars 85 forks source link

Compile error due to concepts #452

Closed NAThompson closed 1 year ago

NAThompson commented 1 year ago
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/isq/si/time.h:26:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/quantity.h:26:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/bits/common_quantity.h:25:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/bits/dimension_op.h:25:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/bits/derived_dimension_base.h:25:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/base_dimension.h:26:
In file included from ~/.conan2/p/mp-un12aa407901b2e/p/include/units/bits/external/fixed_string.h:25:
~/.conan2/p/mp-un12aa407901b2e/p/include/units/bits/external/hacks.h:105:7: fatal error: use of undeclared identifier 'concepts'
using concepts::common_with;
      ^
1 error generated.

Compiler:

clang++ --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

CMakeLists.txt does set the flags to C++20:

set(CMAKE_CXX_STANDARD 20)

Upgraded my compiler and reproduced with:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
mpusz commented 1 year ago

@NAThompson, I assume you are using 0.7.0 from our Artifactory and not from ConanCenter, right? We reached the same issue trying to make it work in ConanCenter (see here: https://github.com/conan-io/conan-center-index/pull/16252#issuecomment-1511849954). I do not have any access or experience with MacOS so can't reproduce or find a solution.

It would be great if you could provide a PR against 0.7.0. With that, we could finally close this issue and have the 0.7.0 release in ConanCenter. I think that the mainline should work on apple-clang now so you can find some solution that fixed the problem there.

NAThompson commented 1 year ago

I have verified that if I source build master then I can build successfully. Closing as I can succeed using this technique.

mpusz commented 1 year ago

Yes, it is fixed on the mainline. I am not sure what actually needs fixing in 0.7.0 though as I do not have access to MacOS. In case you would have time to compare and fix 0.7.0, then please let us know so we can patch the release.