2
0
mirror of https://github.com/boostorg/compat.git synced 2026-01-19 04:02:16 +00:00

Add nontype_test.cpp

This commit is contained in:
Peter Dimov
2025-11-01 17:18:55 +02:00
parent f897f32064
commit 8e7e16e9c3
2 changed files with 35 additions and 0 deletions

View File

@@ -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 ;

33
test/nontype_test.cpp Normal file
View File

@@ -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 <boost/compat/nontype.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/config/pragma_message.hpp>
#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