From patchwork Tue Jun 14 17:38:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 100390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 66ED4B6F99 for ; Wed, 15 Jun 2011 03:38:58 +1000 (EST) Received: (qmail 4691 invoked by alias); 14 Jun 2011 17:38:56 -0000 Received: (qmail 4682 invoked by uid 22791); 14 Jun 2011 17:38:56 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_CX, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 17:38:42 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5EHcfBv010863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Jun 2011 13:38:42 -0400 Received: from [127.0.0.1] (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5EHcfnv018686 for ; Tue, 14 Jun 2011 13:38:41 -0400 Message-ID: <4DF79CA1.7010001@redhat.com> Date: Tue, 14 Jun 2011 13:38:41 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/49117 (error message regression on conversion failure) 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 PR 49117 complains that the error message given on conversion failure regressed from 4.5 to 4.6 in that it no longer prints the source type. So I've added it back in. While I was at it, I've also tweaked the compiler to also print the typedef-stripped version of a type when appropriate, which should help with understanding template error messages. Tested x86_64-pc-linux-gnu, applying to trunk and 4.6. commit 16136651e85c19a1e8338a0bd1b2b1a453413c23 Author: Jason Merrill Date: Tue Jun 14 09:43:25 2011 -0400 * error.c (type_to_string): Print typedef-stripped version too. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 96796c2..22470dc 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2632,6 +2632,15 @@ type_to_string (tree typ, int verbose) reinit_cxx_pp (); dump_type (typ, flags); + if (typ && TYPE_P (typ) && typ != TYPE_CANONICAL (typ) + && !uses_template_parms (typ)) + { + tree aka = strip_typedefs (typ); + pp_string (cxx_pp, " {aka"); + pp_cxx_whitespace (cxx_pp); + dump_type (aka, flags); + pp_character (cxx_pp, '}'); + } return pp_formatted_text (cxx_pp); }