diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 85b55b5dee9..6d6d5014231 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2011-05-28 Jonathan Wakely + + * testsuite/20_util/pointer_traits/pointer_to.cc: New. + 2011-05-28 Jonathan Wakely * include/Makefile.am: Add new ptr_traits.h header. 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 index 00000000000..557e3848a17 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pointer_traits/pointer_to.cc @@ -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 +// . + + +#include +#include + +struct Ptr +{ + typedef bool element_type; + + static bool* pointer_to(bool& b) { return 0; } +}; + +void test01() +{ + bool test = true; + + VERIFY( std::pointer_traits::pointer_to(test) == 0 ); +} + +void test02() +{ + bool test = true; + + VERIFY( std::pointer_traits::pointer_to(test) == &test ); +} + +int main() +{ + test01(); + test02(); + return 0; +}