From e0bd7e85609c6bc422fc3e7883c406758c953860 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 10 Jan 2025 02:57:33 +0200 Subject: [PATCH] Add array_elems_test.cpp --- test/Jamfile.v2 | 1 + test/array_elems_test.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/array_elems_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 11609ab..91cb6af 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -29,6 +29,7 @@ run array_hash.cpp # run array_typedef_test.cpp ; +run array_elems_test.cpp ; # diff --git a/test/array_elems_test.cpp b/test/array_elems_test.cpp new file mode 100644 index 0000000..0204c66 --- /dev/null +++ b/test/array_elems_test.cpp @@ -0,0 +1,26 @@ +// Copyright 2025 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +template void test() +{ + boost::array a = {}; + + T (&e)[ N ] = a.elems; + + BOOST_TEST_EQ( static_cast( e ), static_cast( &a ) ); +} + +int main() +{ + test(); + test(); + + test(); + test(); + + return boost::report_errors(); +}