From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22792 invoked by alias); 23 Mar 2010 15:05:01 -0000 Received: (qmail 22690 invoked by uid 22791); 23 Mar 2010 15:04:58 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from vsmtp12.tin.it (HELO vsmtp12.tin.it) (212.216.176.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Mar 2010 15:04:52 +0000 Received: from [192.168.0.4] (79.25.197.38) by vsmtp12.tin.it (8.5.113) id 4B01E7CF0B3E3F1B; Tue, 23 Mar 2010 16:04:48 +0100 Message-ID: <4BA8D88F.4050001@oracle.com> Date: Tue, 23 Mar 2010 15:22:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100228 SUSE/3.0.3-1.1.1 Thunderbird/3.0.3 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Add some type_traits tests Content-Type: multipart/mixed; boundary="------------070706040909060002020601" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg01065.txt.bz2 This is a multi-part message in MIME format. --------------070706040909060002020601 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 83 Hi, tested x86_64-linux, committed to mainline. Paolo. //////////////////////// --------------070706040909060002020601 Content-Type: text/plain; name="CL_tests" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CL_tests" Content-length: 208 2010-03-23 Paolo Carlini * testsuite/20_util/is_trivial/value.cc: New. * testsuite/20_util/is_standard_layout/value.cc: Likewise. * testsuite/20_util/is_pod/value.cc: Extend. --------------070706040909060002020601 Content-Type: text/plain; name="patch_tests" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_tests" Content-length: 5238 Index: testsuite/20_util/is_trivial/value.cc =================================================================== --- testsuite/20_util/is_trivial/value.cc (revision 0) +++ testsuite/20_util/is_trivial/value.cc (revision 0) @@ -0,0 +1,70 @@ +// { dg-options "-std=gnu++0x" } +// 2010-03-23 Paolo Carlini +// +// Copyright (C) 2010 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 +#include + +struct NType // neither trivial nor standard-layout +{ + int i; + int j; + virtual ~NType(); +}; + +struct TType // trivial but not standard-layout +{ + int i; + +private: + int j; +}; + +struct SLType // standard-layout but not trivial +{ + int i; + int j; + ~SLType(); +}; + +struct PODType // both trivial and standard-layout +{ + int i; + int j; +}; + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_trivial; + using namespace __gnu_test; + + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); +} + +int main() +{ + test01(); + return 0; +} Index: testsuite/20_util/is_pod/value.cc =================================================================== --- testsuite/20_util/is_pod/value.cc (revision 157668) +++ testsuite/20_util/is_pod/value.cc (working copy) @@ -22,6 +22,34 @@ #include #include +struct NType // neither trivial nor standard-layout +{ + int i; + int j; + virtual ~NType(); +}; + +struct TType // trivial but not standard-layout +{ + int i; + +private: + int j; +}; + +struct SLType // standard-layout but not trivial +{ + int i; + int j; + ~SLType(); +}; + +struct PODType // both trivial and standard-layout +{ + int i; + int j; +}; + void test01() { bool test __attribute__((unused)) = true; @@ -43,8 +71,12 @@ VERIFY( (test_category(true)) ); VERIFY( (test_category(true)) ); VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); } int main() Index: testsuite/20_util/is_standard_layout/value.cc =================================================================== --- testsuite/20_util/is_standard_layout/value.cc (revision 0) +++ testsuite/20_util/is_standard_layout/value.cc (revision 0) @@ -0,0 +1,70 @@ +// { dg-options "-std=gnu++0x" } +// 2010-03-23 Paolo Carlini +// +// Copyright (C) 2010 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 +#include + +struct NType // neither trivial nor standard-layout +{ + int i; + int j; + virtual ~NType(); +}; + +struct TType // trivial but not standard-layout +{ + int i; + +private: + int j; +}; + +struct SLType // standard-layout but not trivial +{ + int i; + int j; + ~SLType(); +}; + +struct PODType // both trivial and standard-layout +{ + int i; + int j; +}; + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::is_standard_layout; + using namespace __gnu_test; + + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); +} + +int main() +{ + test01(); + return 0; +} --------------070706040909060002020601--