From patchwork Wed Jan 17 18:09:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 862483 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-471510-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Q6EI4zxE"; 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 3zMFV21zmrz9sNx for ; Thu, 18 Jan 2018 05:09:30 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=Td6OQON/wTL6gq8umO7scKuPAOdX/DppK1qfrSa6diA9r1mPKN cmwCofjOrgVX7CNcUO1eMUYTRVBV1ZE1naLg0nIxIpHh1kznqdcU6SFzqMykfGYG k6DqTjG0wjiBPtoAYeIfP3Hpvp/fR0XGjgmk9L+DvlCv8nRfGJbUbRADg= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=V+yrkujsqsr+9r6qhuoaY0PVxD8=; b=Q6EI4zxEu1y8WIx0tOFf 9hl7AZdqhqm1O6LSOrRXzrwFXP4WrhT6prd9KF5hTxBMwcUuyJlfi7B6tr6IoiHY XnonoMqSnDpgWQ797Hr+ClAMQlrA0BpjUsyItRK2KZhdRAk7qqNFbnRms0CUo60z OK7ztl3gNG61FSs74ywAkLY= Received: (qmail 98270 invoked by alias); 17 Jan 2018 18:09:14 -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 98164 invoked by uid 89); 17 Jan 2018 18:09:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yw0-f169.google.com Received: from mail-yw0-f169.google.com (HELO mail-yw0-f169.google.com) (209.85.161.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jan 2018 18:09:07 +0000 Received: by mail-yw0-f169.google.com with SMTP id q6so4701655ywg.3 for ; Wed, 17 Jan 2018 10:09:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=OrY6GeUJ/OP4thOF+C+Ruyf9fzFHzM1/71Lwgdpp/5U=; b=rZT4WeyUxut9bXTFrdIcGCseUfmUDJ40dVRi68r0st3p6E2tkpqjovn7jRcmwEcbWY x1Cx4NZVMIuJaR08va1N/hxKaHZtshBkeILMiAya1MbVFYATqIkTnoWYliQaqCTCPZsM m6atMMuotvwUme9oF54WkDNR064r3b+bmWuQKH4yHbB4+a5txlzX8ic3eDSLn5PiNb0A +VYo8U9H7Q6CYA89SKzctLacZXduy48LFw0tJfUdpraXs09JUnvM4Yb81+sz9Rh70W8Z q/zlkQ1HGdVCh15z6HzD7ozfOS6ilGaiAsXuyDeTYSC8XTMHeDYOvaKBeyg/X0BBqgsM Ydww== X-Gm-Message-State: AKwxyteu6Xh+dLaFEC5xBFemf8WdjBtzYiXyheb3IX26GoknUUUhtuIZ Y8a5FKMCufqYJRS3EY7V/U4= X-Google-Smtp-Source: ACJfBosEbeO8tbA8pbXbyL8tkMyOrRmNSOmwKeIBRGT6iM9MG3/8hWcUXrdw2oUQ4yDhQ3m0VUAw8g== X-Received: by 10.129.199.73 with SMTP id i9mr3675110ywl.66.1516212545375; Wed, 17 Jan 2018 10:09:05 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::2:280f]) by smtp.googlemail.com with ESMTPSA id e188sm1988046ywd.82.2018.01.17.10.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 10:09:04 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [C++/83287] Another overload lookup ice Message-ID: Date: Wed, 17 Jan 2018 13:09:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 This fixes the other problem in 83287, another case where a lookup was not marked for keeping. I checked other build4 (& build3) calls, and it looks like this is the only one where this could happen. Also, retested using the original testcase and no further issues discovered. nathan 2018-01-17 Nathan Sidwell PR c++/83287 * init.c (build_raw_new_expr): Scan list for lookups to keep. PR c++/83287 * g++.dg/lookup/pr83287-2.C: New. Index: cp/init.c =================================================================== --- cp/init.c (revision 256795) +++ cp/init.c (working copy) @@ -2325,7 +2325,12 @@ build_raw_new_expr (vec *pl else if (init->is_empty ()) init_list = void_node; else - init_list = build_tree_list_vec (init); + { + init_list = build_tree_list_vec (init); + for (tree v = init_list; v; v = TREE_CHAIN (v)) + if (TREE_CODE (TREE_VALUE (v)) == OVERLOAD) + lookup_keep (TREE_VALUE (v), true); + } new_expr = build4 (NEW_EXPR, build_pointer_type (type), build_tree_list_vec (placement), type, nelts, Index: testsuite/g++.dg/lookup/pr83287-2.C =================================================================== --- testsuite/g++.dg/lookup/pr83287-2.C (revision 0) +++ testsuite/g++.dg/lookup/pr83287-2.C (working copy) @@ -0,0 +1,20 @@ +// PR c++/83287 failed to keep lookup until instantiation time + +void foo (); + +namespace { + void foo (); +} + +template +void +bar () +{ + new T (foo); // { dg-error "cannot resolve" } +} + +void +baz () +{ + bar (); +}