From patchwork Sun Mar 9 19:15:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ville Voutilainen X-Patchwork-Id: 328377 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F407A2C009F for ; Mon, 10 Mar 2014 06:16:00 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=L6QOLfJ6FCO402dNAVzhFgjRvxw33dAcL8bIgvSVOOBqmI 2vzMN0ThTI5/Rupnzn5mQl2k5qSd3kfHwGB9AnoSa8jFgOJP9KnGjgEi7wz9IbS6 EDcFiRGwWfDBzU90DQvqy2XTOihJ44vHykwGiXTY5lEXOz6oUcQ2zEmC7qPV0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=VLB74i9z9K7fTiJebKVYH1ECZcw=; b=QQIVv4WyLK3xxrAt1BmO 0ceFY8AM5GnzpdsyTjXPZeNUc1fGG5j7WdcFTKmuiyllpUxvP7eq+WMJCnK67RGC efpcutCZJJWSICKE2QsWiy9FZN6eQ1TG+x0grCEgLVJPsTQ8Q2sBTYflgz2aHemn ol3hHuT3GpQH62SmQbDnmMI= Received: (qmail 25034 invoked by alias); 9 Mar 2014 19:15:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 25009 invoked by uid 89); 9 Mar 2014 19:15:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f172.google.com Received: from mail-qc0-f172.google.com (HELO mail-qc0-f172.google.com) (209.85.216.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 09 Mar 2014 19:15:46 +0000 Received: by mail-qc0-f172.google.com with SMTP id i8so6895904qcq.3 for ; Sun, 09 Mar 2014 12:15:44 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.140.89.167 with SMTP id v36mr34689180qgd.27.1394392543976; Sun, 09 Mar 2014 12:15:43 -0700 (PDT) Received: by 10.224.12.142 with HTTP; Sun, 9 Mar 2014 12:15:43 -0700 (PDT) Date: Sun, 9 Mar 2014 21:15:43 +0200 Message-ID: Subject: [libstdc++-v3] PATCH, RFC: implement is_trivially_default_constructible From: Ville Voutilainen To: "gcc-patches@gcc.gnu.org" , jwakely@redhat.com, Paolo Carlini This is my first shot at library patches. Do tell me if there's anything massively wrong. Tested on x86_64-linux. 2014-03-09 Ville Voutilainen Implement is_trivially_default_constructible. * doc/xml/manual/status_cxx2011.xml: Remove mention of is_trivially_default_cons tructible not being implemented * include/std/type_traits (is_trivially_default_constructible): New. * testsuite/20_util/is_trivially_default_constructible/value.cc: New. diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml index b3c24d8..aaa4887 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml @@ -816,7 +816,7 @@ particular release. Type properties Partial Missing is_trivially_copyable, - is_trivially_constructible, is_trivially_default_constructible, + is_trivially_constructible, is_trivially_copy_constructible, is_trivially_move_constructible, is_trivially_assignable, is_trivially_default_assignable, is_trivially_copy_assignable, is_trivially_move_assignable diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 4b434a6..b529ee6 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1258,7 +1258,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_trivially_constructible (still unimplemented) - /// is_trivially_default_constructible (still unimplemented) + /// is_trivially_default_constructible + template + struct is_trivially_default_constructible + : public __and_, integral_constant>::type + { }; /// is_trivially_copy_constructible (still unimplemented) diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc new file mode 100644 index 0000000..4d10275 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_trivially_default_constructible/value.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// +// 2014-03-09 Ville Voutilainen +// +// Copyright (C) 2014 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 + +void test01() +{ + using std::is_trivially_default_constructible; + using namespace __gnu_test; + + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + + static_assert(test_category(false), ""); + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); + +}