OSDN Git Service

2011-05-28 Jonathan Wakely <jwakely.gcc@gmail.com>
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 28 May 2011 17:13:48 +0000 (17:13 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 28 May 2011 17:13:48 +0000 (17:13 +0000)
* testsuite/20_util/pointer_traits/pointer_to.cc: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174381 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc [new file with mode: 0644]

index 85b55b5..6d6d501 100644 (file)
@@ -1,5 +1,9 @@
 2011-05-28  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
 2011-05-28  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
+       * testsuite/20_util/pointer_traits/pointer_to.cc: New.
+
+2011-05-28  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
        * include/Makefile.am: Add new ptr_traits.h header.
        * include/Makefile.in: Regenerate.
        * include/bits/ptr_traits.h (pointer_traits): New.
        * include/Makefile.am: Add new ptr_traits.h header.
        * include/Makefile.in: Regenerate.
        * include/bits/ptr_traits.h (pointer_traits): New.
diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc
new file mode 100644 (file)
index 0000000..557e384
--- /dev/null
@@ -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;
+}