From patchwork Mon Nov 18 15:53:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 1196832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513935-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="O711ws9O"; dkim-atps=neutral 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 47Gtm93Kxvz9sPJ for ; Tue, 19 Nov 2019 02:53:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=RLZAfEjLsG+tvqKrSY+gqYIJ3k6EXZPvWK9+BSc9fq4C5mmeP1 bYFtdU05luGkUuyHwxi2NckFAreVuav+s/Wh/EPRRAHAaCKGGB3h4WPgvk48vF4V zQpGayxxHrHJ7VAwhWjwl6MBUr4cFwOE2ik/THEyaxkpvgqOR2m8LmbNQ= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=6E2w43gRAgzoli6kZRnOiRUHWpM=; b=O711ws9OWb8/BFfEiFBA gIaZm23AHv2sLrJQ4gSnVivwb6q4fRQ2iIm9upUneFSO5kO6gPEUMV9hIPSTNSVT HOKXAoXuS6dytnG8r4KA7/3ThLHF/zzucyyVC+kfZPkcYYHcdJcXmOZ+6NLJALj5 EHpNIFHAzQRAPsarp4C97S8= Received: (qmail 39919 invoked by alias); 18 Nov 2019 15:53:28 -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 39858 invoked by uid 89); 18 Nov 2019 15:53:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1972, *p2 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Nov 2019 15:53:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6FB98ACD9; Mon, 18 Nov 2019 15:53:19 +0000 (UTC) From: Martin Jambor To: GCC Patches Cc: Feng Xue OS Subject: [committed] Add testcase for already fixed PR ipa/92528 User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/26.3 (x86_64-suse-linux-gnu) Date: Mon, 18 Nov 2019 16:53:18 +0100 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, I have committed the patch below to add the testcase for the already fixed PR ipa/92528 to the testsuite. Thanks, Martin 2019-11-18 Martin Jambor PR ipa/92528 * g++.dg/ipa/pr92528.C: New test. Index: gcc/testsuite/g++.dg/ipa/pr92528.C =================================================================== --- gcc/testsuite/g++.dg/ipa/pr92528.C (nonexistent) +++ gcc/testsuite/g++.dg/ipa/pr92528.C (working copy) @@ -0,0 +1,64 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=c++11 -w" } */ + +template struct A { + _T1 first; + _T2 second; + template + A(_U1 &&p1, _U2 p2) : first(p1), second(p2) {} +}; +class B { +public: + B(char *); +}; +struct C { + virtual ~C(); +}; +struct D { + virtual void registerReporter(B const &, int *) = 0; +}; +template class F { +public: + void _M_get_insert_unique_pos(); + template A _M_emplace_unique(_Args &&...); +}; +template +template +A F<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_unique( + _Args &&...) try { + _M_get_insert_unique_pos(); +} catch (...) { +} +class G { + F _M_t; + +public: + void insert(A p1) { _M_t._M_emplace_unique(p1); } +}; +class H { +public: + void registerReporter(B const &p1, int *p2) { + A a(p1, p2); + m_factories.insert(a); + } + G m_factories; +}; +namespace { +class J : C, D { + void registerReporter(B const &p1, int *p2) { + m_reporterRegistry.registerReporter(p1, p2); + } + H m_reporterRegistry; +}; +J fn1(); +} // namespace +void fn2() { fn1(); } +D &fn3(); +class I { +public: + I(B p1) { fn3().registerReporter(p1, new int); } +}; +namespace { +I b(""); +}