Patchwork [v3] Implement pointer_traits and allocator_traits

login
register
mail settings
Submitter Jonathan Wakely
Date May 28, 2011, 5:14 p.m.
Message ID <BANLkTi=ubEjm0m-WVpF8BP+sn-QJ9okeaA@mail.gmail.com>
Download mbox | patch
Permalink /patch/97806/
State New
Headers show

Comments

Jonathan Wakely - May 28, 2011, 5:14 p.m.
One more test

2011-05-28  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * testsuite/20_util/pointer_traits/pointer_to.cc: New.

Tested x86_64-linux, committed to trunk.
Jonathan Wakely - May 28, 2011, 7:08 p.m.
On 28 May 2011 18:14, Jonathan Wakely wrote:
> One more test
>
> 2011-05-28  Jonathan Wakely  <jwakely.gcc@gmail.com>
>
>        * testsuite/20_util/pointer_traits/pointer_to.cc: New.
>
> Tested x86_64-linux, committed to trunk.
>

This new test is failing, I'm looking into why, will revert it if necessary ...

Patch

Index: testsuite/20_util/pointer_traits/pointer_to.cc
===================================================================
--- testsuite/20_util/pointer_traits/pointer_to.cc	(revision 0)
+++ testsuite/20_util/pointer_traits/pointer_to.cc	(revision 0)
@@ -0,0 +1,50 @@ 
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <memory>
+#include <testsuite_hooks.h>
+
+struct Ptr
+{
+  typedef bool element_type;
+
+  static bool* pointer_to(bool& b) { return 0; }
+};
+
+void test01()
+{
+  bool test = true;
+
+  VERIFY( std::pointer_traits<Ptr>::pointer_to(test) == 0 );
+}
+
+void test02()
+{
+  bool test = true;
+
+  VERIFY( std::pointer_traits<bool*>::pointer_to(test) == &test );
+}
+
+int main()
+{
+  test01();
+  test02();
+  return 0;
+}