From 6364fcdf7ee53a0e28d4a4dba54ac779c366cc5f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 5 Jun 2023 19:26:53 +0200 Subject: [PATCH] fix: `IntermediateDerivedQuantitySpec` now also accounts for `kind_of` --- .../include/mp-units/bits/quantity_spec_concepts.h | 5 ++++- test/unit_test/static/quantity_spec_test.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/include/mp-units/bits/quantity_spec_concepts.h b/src/core/include/mp-units/bits/quantity_spec_concepts.h index 1b5afa2a..27543dde 100644 --- a/src/core/include/mp-units/bits/quantity_spec_concepts.h +++ b/src/core/include/mp-units/bits/quantity_spec_concepts.h @@ -131,7 +131,10 @@ namespace detail { * explicitly not supported here. */ template -concept IntermediateDerivedQuantitySpec = is_specialization_of; +concept IntermediateDerivedQuantitySpec = + is_specialization_of || + (QuantityKindSpec && + is_specialization_of, derived_quantity_spec>); } // namespace detail diff --git a/test/unit_test/static/quantity_spec_test.cpp b/test/unit_test/static/quantity_spec_test.cpp index a48db799..5ed6c059 100644 --- a/test/unit_test/static/quantity_spec_test.cpp +++ b/test/unit_test/static/quantity_spec_test.cpp @@ -128,16 +128,22 @@ static_assert(!detail::NamedQuantitySpec); static_assert(detail::IntermediateDerivedQuantitySpec); static_assert(!detail::QuantityKindSpec); +static_assert(QuantitySpec>); +static_assert(!detail::BaseQuantitySpec>); +static_assert(!detail::NamedQuantitySpec>); +static_assert(detail::IntermediateDerivedQuantitySpec>); +static_assert(detail::QuantityKindSpec>); + static_assert(QuantitySpec / kind_of