From patchwork Fri Dec 13 05:05:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1208959 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-515842-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FnRRF5Ai"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Fr1yElOM"; 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 47YzBl68wyz9sNH for ; Fri, 13 Dec 2019 16:05:33 +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:subject:date:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=qYn+9qfIJFipz4E3 IIEV0xF/VAleMl1znuzwOHpTUKCMXFYqn2WYFraqD101imXfx/apBVVPd5dgvCl1 HWi3mherKHIHqGs4SWkydyWFcWx+UZ5GPeDDqg0e4maGQTl+hZ2wXqWYRO55tNF9 q3OyYmlUpemsuSWudht3Pzma1V8= 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:subject:date:message-id:content-type :content-transfer-encoding; s=default; bh=YmjPqJFqEXI8XTU+tN01KK 6Sj28=; b=FnRRF5Aio177n4I0Go4OZTAZMV1lfAjbvTlBE3xM4tsQVB16vAuORk bCfFCHcXf7P/Y3wmOJN1COdn5rxH9D+hMJDYN+XtvRhRKsmodT5LEftgjOOux/Bc TuhMQRzo/RPqTXNaBR2pYP1lO+YbhcDU5+/zLzWU9atnidjjw5x4M= Received: (qmail 41881 invoked by alias); 13 Dec 2019 05:05:26 -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 41872 invoked by uid 89); 13 Dec 2019 05:05:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 05:05:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576213523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lvhdeIbliotREA1xkS9RPzLo2TlUnxz90ml/J/d9dlA=; b=Fr1yElOMGaKvF9mnT8eT4QOjXNjrLTLO0QHIF6BonDptIyip6itTe83WPrqRwWUQx3WaiV 3IswVinOqi7Pw+ohP5XptRaji/sN4ISZ4Z1OhgzzQDCVOTxbOTVNCACemjNF0JqkfzBczc hA+7ti1WgGsUXvf/RuqhVCAsTvK/+Xw= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-UDkKF9OAO_Otf5W_Gz7esg-1; Fri, 13 Dec 2019 00:05:21 -0500 Received: by mail-qk1-f199.google.com with SMTP id s9so693784qkg.21 for ; Thu, 12 Dec 2019 21:05:21 -0800 (PST) Received: from barrymore.redhat.com (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id k62sm2496698qkc.95.2019.12.12.21.05.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 21:05:19 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] PR c++/92496 - ICE with <=> and no #include . Date: Fri, 13 Dec 2019 00:05:18 -0500 Message-Id: <20191213050518.29669-1-jason@redhat.com> X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes Normal error-recovery. Tested x86_64-pc-linux-gnu, applying to trunk. * typeck.c (cp_build_binary_op): Handle error from spaceship_type. --- gcc/cp/typeck.c | 6 +++++- gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C base-commit: 3dbaca45883c354c9d4e9542d5c95f054997f844 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d0f739895c9..d3814585e3f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5418,7 +5418,11 @@ cp_build_binary_op (const op_location_t &location, result_type = NULL_TREE; if (result_type) - build_type = spaceship_type (result_type, complain); + { + build_type = spaceship_type (result_type, complain); + if (build_type == error_mark_node) + return error_mark_node; + } if (result_type && arithmetic_types_p) { diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C new file mode 100644 index 00000000000..45ce4ee047a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C @@ -0,0 +1,12 @@ +// PR c++/92496 +// { dg-do compile { target c++2a } } + +template +struct A {}; + +struct B { + constexpr auto operator<=>(const B&) const = default; // { dg-error "" } + int value; +}; + +A t;