Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3085,6 +3085,13 @@ return; break; +// Get the type traits tokens. Let them behave like any other identifier (which +// may also be a type trait). +#define TYPE_TRAIT(N, I, K) case tok::kw_##I: +#define ARRAY_TYPE_TRAIT(I, E, K) case tok::kw_##I: +#define EXPRESSION_TRAIT(I, E, K) case tok::kw_##I: +#include "clang/Basic/TokenKinds.def" + case tok::identifier: // We need to differentiate identifiers for a template deduction guide, // variables, or function return types (the constraint expression has Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -23743,6 +23743,15 @@ verifyFormat("template \n" "concept Node = std::is_object_v;"); + verifyFormat("template \n" + "concept integral = __is_integral(T);"); + + verifyFormat("template \n" + "concept is2D = __array_extent(T, 1) == 2;"); + + verifyFormat("template \n" + "concept isRhs = __is_rvalue_expr(std::declval() + 2)"); + auto Style = getLLVMStyle(); Style.BreakBeforeConceptDeclarations = FormatStyle::BBCDS_Allowed;