From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../testsuite/18_support/type_info/fundamental.cc | 79 ++++++++++++++++++++++ .../testsuite/18_support/type_info/hash_code.cc | 79 ++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 libstdc++-v3/testsuite/18_support/type_info/fundamental.cc create mode 100644 libstdc++-v3/testsuite/18_support/type_info/hash_code.cc (limited to 'libstdc++-v3/testsuite/18_support/type_info') diff --git a/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc b/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc new file mode 100644 index 000000000..00c64b8cf --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc @@ -0,0 +1,79 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-effective-target dfp } + +// 2011-02-23 Benjamin Kosnik +// +// Copyright (C) 2011 Free Software Foundation +// +// 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 +#include + +template + std::string + gen_type_info() + { + std::string s1 = typeid(_Tp).name(); + std::string s2 = typeid(_Tp*).name(); + std::string s3 = typeid(const _Tp*).name(); + return std::max(std::max(s1, s2), s3); + } + +// libstdc++/43622, others +int main() +{ + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + gen_type_info(); + + gen_type_info(); + gen_type_info(); + gen_type_info(); + + gen_type_info(); + + gen_type_info(); + + // decimal + gen_type_info(); + gen_type_info(); + gen_type_info(); + + // attributes +#if 0 + typedef int ti_type __attribute__((__mode__(TI))); + gen_type_info(); + + typedef float tf_type __attribute__((__mode__(TF))); + gen_type_info(); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/18_support/type_info/hash_code.cc b/libstdc++-v3/testsuite/18_support/type_info/hash_code.cc new file mode 100644 index 000000000..2d4c65bc5 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/type_info/hash_code.cc @@ -0,0 +1,79 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-09-21 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation +// +// 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 + +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + class Abraca { }; + Abraca a1, a2_; + + typedef const Abraca cAbraca; + cAbraca a2 = a2_; + + class Dabra { }; + Dabra d1; + + const type_info& to01 = typeid(int); + const type_info& to02 = typeid(double); + VERIFY( to01 != to02 ); + VERIFY( to01.hash_code() != to02.hash_code() ); + + const type_info& to03 = typeid(a1); + const type_info& to04 = typeid(a2); + VERIFY( to03 == to04 ); + VERIFY( to03.hash_code() == to04.hash_code() ); + + const type_info& to05 = typeid(Abraca); + const type_info& to06 = typeid(cAbraca); + VERIFY( to05 == to06 ); + VERIFY( to05.hash_code() == to06.hash_code() ); + + const type_info& to07 = typeid(Abraca); + const type_info& to08 = typeid(a2); + VERIFY( to07 == to08 ); + VERIFY( to07.hash_code() == to08.hash_code() ); + + const type_info& to09 = typeid(Abraca); + const type_info& to10 = typeid(const Abraca&); + VERIFY( to09 == to10 ); + VERIFY( to09.hash_code() == to10.hash_code() ); + + const type_info& to11 = typeid(Abraca); + const type_info& to12 = typeid(Dabra); + VERIFY( to11 != to12 ); + VERIFY( to11.hash_code() != to12.hash_code() ); + + const type_info& to13 = typeid(a1); + const type_info& to14 = typeid(d1); + VERIFY( to13 != to14 ); + VERIFY( to13.hash_code() != to14.hash_code() ); +} + +int main() +{ + test01(); + return 0; +} -- cgit v1.2.3