From patchwork Fri Mar 6 18:41:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1250574 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-520800-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 48YxLL5dhfz9sPK for ; Sat, 7 Mar 2020 05:42:16 +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 :content-transfer-encoding; q=dns; s=default; b=btCyA6R7w9699bmp 4wSWOs62lPv7LCaPdDz3ZBISHLVpR6hJPqFiSHikZ6CmC5gPuFxYl824jQWzxJ3X 9P6MGJYBpDnHEzqHcx5cEEUFt7F3tp0sYwCiwmfezFd/KfFuQIKLGMFJZRQa587d 1atHoZLxc9OYGfTUzJzfp4/FGb8= 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 :content-transfer-encoding; s=default; bh=TaL98CL7jTud6jGu5ahPtV vcXsw=; b=tiiNqEq21ecxnZXGKYYTSEaNInCZaJGGciV1PsJ31BSiqpiJO9EePf qqRNO8Wtw4KXX4wi5V6mpIkhC3sjjjZ8DhzNEpYs62EzipV/n+iFG657kYP7G9kS HLFjSWXp6ToHcKI76rNEb3rtGPLkvIzB2EaNYN2VwqE1n/yjqqbHs= Received: (qmail 26901 invoked by alias); 6 Mar 2020 18:42:08 -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 26887 invoked by uid 89); 6 Mar 2020 18:42:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 18:42:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583520125; h=from:from: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=KnJoTHA8gGF0b+NHDxBW1nlni9v340sArl7aBkUFg2s=; b=h2afdmlPTSpF7rpPx5Ck5u9fZZPV7gS8so581PutcfNkPCchkwm16zAdCfyr6A7nTpoMic ORTDGj81rFcOZq1iMYrhu+mB1xEGO0DdeF+6au7N4c6cmWwWMdo1PS60NXyQTUVUJqltgK 73TGCZUxR2JH4pss97NBxM9OEV3VDj0= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-113-LWiQPpSfN-SDube1Ma_jMA-1; Fri, 06 Mar 2020 13:42:03 -0500 Received: by mail-qv1-f72.google.com with SMTP id r9so1932463qvs.19 for ; Fri, 06 Mar 2020 10:42:03 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id u18sm3613088qtv.96.2020.03.06.10.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 10:42:01 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka Subject: [PATCH] c++: Fix pretty printing of TYPENAME_TYPEs Date: Fri, 6 Mar 2020 13:41:36 -0500 Message-Id: <20200306184137.3926946-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes I noticed that in some concepts diagnostic messages, we were printing typename types incorrectly, e.g. printing remove_reference_t as typename remove_reference::remove_reference_t instead of typename remove_reference::type. Fixed this by looking at TYPENAME_TYPE_FULLNAME instead of TYPE_NAME, which is consistent with how dump_typename in error.c does it. Does this look OK to commit after testing? gcc/cp/ChangeLog: * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier) [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the TYPE_NAME. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic4.C: New test. --- gcc/cp/cxx-pretty-print.c | 2 +- gcc/testsuite/g++.dg/concepts/diagnostic4.C | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/concepts/diagnostic4.C diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 397bdbfa234..100154e400f 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1360,7 +1360,7 @@ cxx_pretty_printer::simple_type_specifier (tree t) case TYPENAME_TYPE: pp_cxx_ws_string (this, "typename"); pp_cxx_nested_name_specifier (this, TYPE_CONTEXT (t)); - pp_cxx_unqualified_id (this, TYPE_NAME (t)); + pp_cxx_unqualified_id (this, TYPENAME_TYPE_FULLNAME (t)); break; default: diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic4.C b/gcc/testsuite/g++.dg/concepts/diagnostic4.C new file mode 100644 index 00000000000..677bc867634 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic4.C @@ -0,0 +1,18 @@ +// { dg-do compile { target c++2a } } + +template + struct remove_reference + { using type = T; }; + +template + using remove_reference_t = remove_reference::type; + +template + inline constexpr bool blah = false; + +template + requires blah> + // { dg-message "typename remove_reference::type" "" { target *-*-* } .-1 } + void foo() { } + +void bar() { foo (); } // { dg-error "use of" }