From patchwork Fri Sep 27 14:08:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 278591 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C10A02C033A for ; Sat, 28 Sep 2013 00:08:49 +1000 (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=Zf+LF47U88DrkfzpfQ74XowjD8VFlzxDjdc+abX0LvV+hj A2ezwbymqMZZjb8fQBi2yCy+LdXbyZEmPlEE5lUi4eoA7wk3CdaZGrNcDdpxGwsp Bffj9dJoQjinUuRI4l2NjJ+rLI3NY2aKoaHCK4Q/kB/hXdPXElWMw07vT+Bxw= 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=hNalBQNASkb6YnDoW0o3L3YbNuU=; b=JHlCxbca+gZA2gMlFDjM iCGkRNHVC7jo1jqvEMJIsAHhN0dUIsZFE+NHPuVhQmSgm7rNvxOKvyCgw6DtyIB1 UWHZJSzrYZfK+wqWooW2TLBcBaPBzjaD0RM0Z0UReOLOMCipFMPKkSWkAfsRv8Jg SN9gZsRq86bFcf3K0DRjzLA= Received: (qmail 17090 invoked by alias); 27 Sep 2013 14:08:34 -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 17069 invoked by uid 89); 27 Sep 2013 14:08:33 -0000 Received: from mail-lb0-f172.google.com (HELO mail-lb0-f172.google.com) (209.85.217.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 27 Sep 2013 14:08:33 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, NO_RELAYS, SPAM_SUBJECT autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lb0-f172.google.com Received: by mail-lb0-f172.google.com with SMTP id x18so2299702lbi.31 for ; Fri, 27 Sep 2013 07:08:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.36.98 with SMTP id p2mr5822366laj.14.1380290908890; Fri, 27 Sep 2013 07:08:28 -0700 (PDT) Received: by 10.112.101.7 with HTTP; Fri, 27 Sep 2013 07:08:28 -0700 (PDT) Date: Fri, 27 Sep 2013 15:08:28 +0100 Message-ID: Subject: [patch] fix libstdc++/57465 From: Jonathan Wakely To: "libstdc++" , gcc-patches PR libstdc++/57465 * include/std/functional (_Function_base::_Base_manager::_M_not_empty_function): Fix overload for pointers. * testsuite/20_util/function/cons/57465.cc: New. Tested x86_64-linux, committed to trunk. I'll apply it to the branches after it's been on trunk without problems for a while. commit 55531e9c74a5f2b4699250b6b302d49f7dc8c5ae Author: Jonathan Wakely Date: Wed Aug 7 01:38:39 2013 +0100 PR libstdc++/57465 * include/std/functional (_Function_base::_Base_manager::_M_not_empty_function): Fix overload for pointers. * testsuite/20_util/function/cons/57465.cc: New. diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 63ba777..73cddfe 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1932,7 +1932,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) template static bool - _M_not_empty_function(const _Tp*& __fp) + _M_not_empty_function(_Tp* const& __fp) { return __fp; } template diff --git a/libstdc++-v3/testsuite/20_util/function/cons/57465.cc b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc new file mode 100644 index 0000000..44413fb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2013 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 +// . + +// libstdc++/57465 + +// { dg-options "-std=gnu++11" } + +#include +#include + +int main() +{ + using F = void(); + F* f = nullptr; + std::function x(f); + VERIFY( !x ); +}