| Issue |
175831
|
| Summary |
[Clang] clang 22 still has problems with mp_units
|
| Labels |
clang:frontend,
regression,
rejects-valid,
concepts
|
| Assignees |
|
| Reporter |
HazardyKnusperkeks
|
Similar to #170856 Clang 22 fails with a simple example: https://godbolt.org/z/c7vE8x6Wh which is accepted by GCC and Clang 21. It was also broken by e9972debc98ce5d00db47409248bbcf06fafaf73 (#161671), but not fixed with a5bfe8e5c3c4c5bb46f53e093caf6aa01d56aeab (#172251).
The example (also used in the godbolt link):
``` c++
#include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/unit_symbols.h>
#include <mp-units/systems/si/units.h>
using namespace mp_units::si::unit_symbols;
mp_units::quantity distance = mp_units::isq::distance(5 * km);
```
The reported error:
```
<source>:7:31: error: no matching function for call to object of type 'const struct distance'
7 | mp_units::quantity distance = mp_units::isq::distance(5 * km);
| ^~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/mp-units/trunk/src/core/include/mp-units/framework/quantity_spec.h:217:41: note: candidate template ignored: constraints not satisfied [with Self = struct distance, FwdQ = quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>, Q = std::remove_cvref_t<quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>>]
217 | [[nodiscard]] constexpr Quantity auto operator()(this Self, FwdQ&& q)
| ^
/opt/compiler-explorer/libs/mp-units/trunk/src/core/include/mp-units/framework/quantity_spec.h:216:33: note: because 'typename quantity<make_reference(Self{}, Q::unit), typename Q::rep>' would be invalid: constraints not satisfied for class template 'quantity' [with R = reference<mp_units::isq::distance, mp_units::si::kilo_<mp_units::si::metre>>{}, Rep = typename std::remove_cvref_t<quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>>::rep]
216 | requires { typename quantity<make_reference(Self{}, Q::unit), typename Q::rep>; }
| ^
/opt/compiler-explorer/libs/mp-units/trunk/src/core/include/mp-units/framework/quantity_spec.h:226:46: note: candidate template ignored: constraints not satisfied [with Self = struct distance, FwdQP = quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>, QP = std::remove_cvref_t<quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>>]
226 | [[nodiscard]] constexpr QuantityPoint auto operator()(this Self self, FwdQP&& qp)
| ^
/opt/compiler-explorer/libs/mp-units/trunk/src/core/include/mp-units/framework/quantity_spec.h:223:43: note: because 'std::remove_cvref_t<quantity<mp_units::si::kilo_<mp_units::si::metre>{}, int>>' (aka 'mp_units::quantity<mp_units::si::kilo_<mp_units::si::metre>{{{{}, {}}}}, int>') does not satisfy 'QuantityPoint'
223 | template<typename Self, typename FwdQP, QuantityPoint QP = std::remove_cvref_t<FwdQP>>
| ^
/opt/compiler-explorer/libs/mp-units/trunk/src/core/include/mp-units/framework/quantity_point_concepts.h:51:25: note: because 'detail::is_quantity_point<mp_units::quantity<mp_units::si::kilo_<mp_units::si::metre>{{{{}, {}}}}, int>>' evaluated to false
51 | concept QuantityPoint = detail::is_quantity_point<T>;
| ^
1 error generated.
Compiler returned: 1
```
I know it's not minimal, but I honestly don't know how to minimize it, maybe @mpusz can help?
CC @cor3ntin @zyn0217
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs