The following C++20 code is accepted by both clang and GCC but rejected by the Sonar static analyzer with "requires clause differs in template redeclaration":
template <typename T>
concept Underlying = /* expression omitted */;
using Frac = std::int16_t;
namespace detail {
template <typename T, typename W, Frac F>
concept ValidParams = /* expression omitted */;
}
template <Underlying T, Underlying W, Frac F = 0>
requires detail::ValidParams<T, W, F>
class FixedPoint final
{
template <Underlying R, Underlying V, Frac E>
requires detail::ValidParams<R, V, E> //< requires clause differs in template redeclaration
friend class FixedPoint;
//...
I skimmed over the relevant chapter of the C++ standard (13. Templates) but found no special requirements on the requires-clause in class template declarations, and the case of a friend class template with requires-clause does not appear to be explicitly covered (nor does it have to be as a friend declaration is not substantially different from an ordinary declaration).
My question is whether this is a defect of the static analyzer or my code is non-compliant.