@@ -24,6 +24,8 @@ concept storage_aggregate_callable = requires(S& storage) {
2424 { storage.template create_aggregate_function <f>() };
2525 { storage.template delete_aggregate_function <f>() };
2626};
27+
28+ constexpr auto clamp_int_ptr = &std::clamp<int >;
2729#endif
2830
2931TEST_CASE (" function static" ) {
@@ -343,16 +345,20 @@ TEST_CASE("function static") {
343345 }
344346#endif
345347 SECTION (" freestanding function" ) {
346- constexpr auto quotedScalar = " f" _scalar.quote (std::clamp<int >);
347- using quoted_type = decltype (" f" _scalar.quote (std::clamp<int >));
348+ #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 12)
349+ SKIP (" GCC < 12 cannot use this function pointer as NTTP in this test." );
350+ #else
351+ constexpr auto quotedScalar = " f" _scalar.quote (clamp_int_ptr);
352+ using quoted_type = decltype (" f" _scalar.quote (clamp_int_ptr));
353+ using expected_callable_type = std::remove_cv_t <decltype (clamp_int_ptr)>;
348354
349355 STATIC_REQUIRE (quotedScalar._nme [0 ] == ' f' && quotedScalar._nme [1 ] == ' \0 ' );
350356 STATIC_REQUIRE (std::is_same_v<decltype (quotedScalar),
351- const quoted_scalar_function<decltype (&std::clamp< int >) ,
357+ const quoted_scalar_function<expected_callable_type ,
352358 const int &(const int &, const int &, const int &),
353359 2 >>);
354360
355- STATIC_REQUIRE (std::is_same_v<quoted_type::callable_type, decltype (&std::clamp< int >) >);
361+ STATIC_REQUIRE (std::is_same_v<quoted_type::callable_type, expected_callable_type >);
356362 STATIC_REQUIRE (std::is_same_v<quoted_type::udf_type, const int &(const int &, const int &, const int &)>);
357363
358364 STATIC_REQUIRE (std::is_same_v<callable_arguments<quoted_type::udf_type>::return_type, int >);
@@ -368,18 +374,25 @@ TEST_CASE("function static") {
368374
369375 using storage_type = decltype (make_storage (" " ));
370376 STATIC_REQUIRE (storage_scalar_callable<storage_type, quotedScalar>);
377+ #endif
371378 }
372379 SECTION (" template function" ) {
373- constexpr auto quotedScalar = " f" _scalar.quote <const int &(const int &, const int &, const int &)>(std::clamp);
374- using quoted_type = decltype (" f" _scalar.quote <const int &(const int &, const int &, const int &)>(std::clamp));
380+ #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 12)
381+ SKIP (" GCC < 12 cannot use this function pointer as NTTP in this test." );
382+ #else
383+ constexpr auto quotedScalar =
384+ " f" _scalar.quote <const int &(const int &, const int &, const int &)>(clamp_int_ptr);
385+ using quoted_type =
386+ decltype (" f" _scalar.quote <const int &(const int &, const int &, const int &)>(clamp_int_ptr));
387+ using expected_callable_type = std::remove_cv_t <decltype (clamp_int_ptr)>;
375388
376389 STATIC_REQUIRE (quotedScalar._nme [0 ] == ' f' && quotedScalar._nme [1 ] == ' \0 ' );
377390 STATIC_REQUIRE (std::is_same_v<decltype (quotedScalar),
378- const quoted_scalar_function<decltype (&std::clamp< int >) ,
391+ const quoted_scalar_function<expected_callable_type ,
379392 const int &(const int &, const int &, const int &),
380393 2 >>);
381394
382- STATIC_REQUIRE (std::is_same_v<quoted_type::callable_type, decltype (&std::clamp< int >) >);
395+ STATIC_REQUIRE (std::is_same_v<quoted_type::callable_type, expected_callable_type >);
383396 STATIC_REQUIRE (std::is_same_v<quoted_type::udf_type, const int &(const int &, const int &, const int &)>);
384397
385398 STATIC_REQUIRE (std::is_same_v<callable_arguments<quoted_type::udf_type>::return_type, int >);
@@ -395,6 +408,7 @@ TEST_CASE("function static") {
395408
396409 using storage_type = decltype (make_storage (" " ));
397410 STATIC_REQUIRE (storage_scalar_callable<storage_type, quotedScalar>);
411+ #endif
398412 }
399413 SECTION (" lambda" ) {
400414 constexpr auto lambda = [](unsigned long errcode) {
0 commit comments