public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [v3] Implement pointer_traits and allocator_traits
Date: Sat, 28 May 2011 22:59:00 -0000	[thread overview]
Message-ID: <BANLkTi=ubEjm0m-WVpF8BP+sn-QJ9okeaA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikWgsRiHvaGf6q0LOJdws-BuyXUMg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

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.

[-- Attachment #2: pointer_to.txt --]
[-- Type: text/plain, Size: 1514 bytes --]

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;
+}

  parent reply	other threads:[~2011-05-28 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 17:05 Jonathan Wakely
2011-05-28 17:14 ` Jonathan Wakely
2011-05-28 17:27 ` Jonathan Wakely
2011-05-28 17:29   ` Jonathan Wakely
2011-05-28 22:59 ` Jonathan Wakely [this message]
2011-05-29  9:39   ` Jonathan Wakely
2011-05-29  9:42     ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=ubEjm0m-WVpF8BP+sn-QJ9okeaA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).