Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-14 16:27:03


Peter Dimov wrote:
>
> It's not that important, I was just curious. What's more important is
> that we don't seem to have a test case for the functionality.
> addressof_test is pretty basic.

Yes, that's an oversight on my part. I've attached a patch to
addressof_test.cpp to test for taking the address of an array. I can
confirm that these new tests pass with VC7.1 and gcc 3.3.3 (cygwin).

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Index: addressof_test.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/utility/addressof_test.cpp,v
retrieving revision 1.4
diff -b -d -u -r1.4 addressof_test.cpp
--- addressof_test.cpp 3 Feb 2005 13:41:16 -0000 1.4
+++ addressof_test.cpp 14 Mar 2005 21:20:38 -0000
@@ -37,5 +37,13 @@
   const volatile nonaddressable& cvx = *px;
   BOOST_CHECK(boost::addressof(cvx) == static_cast<const volatile nonaddressable*>(px));
   
+ int nrg[3] = {1,2,3};
+ int (*pnrg)[3] = &nrg;
+ BOOST_CHECK(boost::addressof(nrg) == pnrg);
+
+ int const cnrg[3] = {1,2,3};
+ int const (*pcnrg)[3] = &cnrg;
+ BOOST_CHECK(boost::addressof(cnrg) == pcnrg);
+
   return 0;
 }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk