From 8e7e16e9c36d34d89c46227a385f3b4a50553042 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 1 Nov 2025 17:18:55 +0200 Subject: [PATCH] Add nontype_test.cpp --- test/Jamfile | 2 ++ test/nontype_test.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/nontype_test.cpp diff --git a/test/Jamfile b/test/Jamfile index 21e7cf1..7ee022b 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -119,3 +119,5 @@ run to_array_lvalue_test.cpp ; run to_array_rvalue_test.cpp ; run to_underlying_test.cpp ; + +run nontype_test.cpp ; diff --git a/test/nontype_test.cpp b/test/nontype_test.cpp new file mode 100644 index 0000000..478870d --- /dev/null +++ b/test/nontype_test.cpp @@ -0,0 +1,33 @@ +// Copyright 2025 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include + +#if !( defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L ) + +BOOST_PRAGMA_MESSAGE("Test skipped, __cpp_nontype_template_parameter_auto is not defined to at least 201606L") +int main() {} + +#else + +void f() {} + +struct X +{ + void f() {} +}; + +int main() +{ + BOOST_TEST_TRAIT_SAME( boost::compat::nontype_t< 5 > const, decltype( boost::compat::nontype< 5 > ) ); + BOOST_TEST_TRAIT_SAME( boost::compat::nontype_t< ::f > const, decltype( boost::compat::nontype< ::f > ) ); + BOOST_TEST_TRAIT_SAME( boost::compat::nontype_t< &X::f > const, decltype( boost::compat::nontype< &X::f > ) ); + + return boost::report_errors(); +} + +#endif