From patchwork Sat Nov 16 00:47:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1195979 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-513714-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="QY+DM54V"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Khsz8AM3"; 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 47FGll5qlBz9sPT for ; Sat, 16 Nov 2019 11:47:45 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=Qv8 oghVQmrQhRcdEMWmS418vItkPUOeDNibSpSgBNld8VB/frOlWS1cWt2Hiqimz4oy /b1mZFS3Z69p/mxAcBQGRt0tE3xQHHc/ya27udByNlR/p/GADM0KN9inAmsOBFQO tDHScQfXkwZRtV5mUSe0P4T+CI1qrQb9dqJer5Q4= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; s=default; bh=tlXVXgLoS 6hUeUs85TUFPUxYDQU=; b=QY+DM54V0rWgtft3BXFgi5zLG7JoZHIvKNbol4ZCM mX7zRIgjvuPvNlscSz4j0PXJWF6oUrBLK4p27oIjsMSEWfky+3ygKxtarQmZorie DfhQr438Xt021FGaV6INEOa2qna/2E4hdSEj9QeHxElla1dbXofOsWVYEIslIE8O wA= Received: (qmail 62274 invoked by alias); 16 Nov 2019 00:47:37 -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 62265 invoked by uid 89); 16 Nov 2019 00:47:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=2019-11-16, 20191116, forming, strong_ordering X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Nov 2019 00:47:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573865254; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TpAThqJ9yYhrVdQI2v6BE2i3ke4EuUhi5toNQ2+oXFg=; b=Khsz8AM3MmedIcz98soe/I8F7/8pP4XkxXTd0dby9/BIbIY/t4KoXnfleKO6/OY5qTPpkT Xf1KYfYdGAANL+fJZ/kWgT3ARn8IOjSQJfunZzoya7oPuTjMN6mVgxZ5fAFydei3nQWEhE fY7ROL1Y3scsMb/ey3du5jx2zV6nXEY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-236-qhqrYloxOP-N1AybfpXLrw-1; Fri, 15 Nov 2019 19:47:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6F29C1005500 for ; Sat, 16 Nov 2019 00:47:30 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0161C10002B6; Sat, 16 Nov 2019 00:47:29 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id xAG0lR4a023974; Sat, 16 Nov 2019 01:47:28 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id xAG0lPBm023973; Sat, 16 Nov 2019 01:47:25 +0100 Date: Sat, 16 Nov 2019 01:47:25 +0100 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix up spaceship diagnostics Message-ID: <20191116004725.GP4650@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 Content-Disposition: inline X-IsSubscribed: yes Hi! While working on the __builtin_source_location patch, I've noticed that these two messages are weird: spaceship-err3.C:11:12: error: ‘std::std::strong_ordering’ is not a type spaceship-err3.C:11:12: note: forming type of ‘operator<=>’ spaceship-err3.C:13:14: error: ‘std::partial_ordering::std::partial_ordering::equivalent()’ is not a static data member spaceship-err3.C:13:14: note: determining value of ‘operator<=>’ Note the doubled std:: in the first case and std::partial_ordering:: in the second case. Most of the code that uses %<%T::%D%> elsewhere prints DECL_NAME rather than the actual decl, but in this case when it is a decl, there is no need to prefix it with anything. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-11-16 Jakub Jelinek * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> to print the decl. (lookup_comparison_category): Use %qD instead of % to print the decl. * g++.dg/cpp2a/spaceship-err3.C: New test. Jakub --- gcc/cp/method.c.jj 2019-11-13 19:13:12.059100901 +0100 +++ gcc/cp/method.c 2019-11-16 00:07:56.080097451 +0100 @@ -924,7 +924,7 @@ lookup_comparison_result (tree type, con if (decl == error_mark_node || TREE_CODE (decl) == TREE_LIST) qualified_name_lookup_error (type, name, decl, input_location); else - error ("%<%T::%D%> is not a static data member", type, decl); + error ("%qD is not a static data member", decl); inform (input_location, "determining value of %qs", "operator<=>"); } return error_mark_node; @@ -951,7 +951,7 @@ lookup_comparison_category (comp_cat_tag if (decl == error_mark_node || TREE_CODE (decl) == TREE_LIST) qualified_name_lookup_error (std_node, name, decl, input_location); else - error ("% is not a type", decl); + error ("%qD is not a type", decl); inform (input_location, "forming type of %qs", "operator<=>"); } return error_mark_node; --- gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C.jj 2019-11-16 00:11:19.105048135 +0100 +++ gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C 2019-11-16 00:12:21.637108940 +0100 @@ -0,0 +1,14 @@ +// { dg-do compile { target c++2a } } + +namespace std +{ + int strong_ordering; + struct partial_ordering { + static int equivalent (); + }; +} + +auto a = 1 <=> 2; // { dg-error "'std::strong_ordering' is not a type" } + // { dg-message "forming type of 'operator<=>'" "" { target *-*-* } .-1 } +auto b = 3.0 <=> 4.0; // { dg-error "'std::partial_ordering::equivalent\\(\\)' is not a static data member" } + // { dg-message "determining value of 'operator<=>'" "" { target *-*-* } .-1 }