From patchwork Fri May 27 19:26:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 97741 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 07BB5B6F83 for ; Sat, 28 May 2011 05:26:52 +1000 (EST) Received: (qmail 6395 invoked by alias); 27 May 2011 19:26:51 -0000 Received: (qmail 6381 invoked by uid 22791); 27 May 2011 19:26:50 -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; Fri, 27 May 2011 19:26:32 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4RJQW1n020062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 27 May 2011 15:26:32 -0400 Received: from [127.0.0.1] (ovpn-113-23.phx2.redhat.com [10.3.113.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4RJQVFO006572 for ; Fri, 27 May 2011 15:26:32 -0400 Message-ID: <4DDFFAE7.6000007@redhat.com> Date: Fri, 27 May 2011 15:26:31 -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++/48284 (-> instead of . in error message) 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 We already handle reference refs properly elsewhere, but needed to handle it here as well. Tested x86_64-pc-linux-gnu, applying to trunk. commit 1e9af8c4d3c615f04f456306587959cdd6c49c26 Author: Jason Merrill Date: Fri May 27 10:54:40 2011 -0400 PR c++/48284 * error.c (dump_expr) [COMPONENT_REF]: Use pp_cxx_dot with INDIRECT_REF of REFERENCE_TYPE. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 8d7aaa7..a40630a 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1890,7 +1890,10 @@ dump_expr (tree t, int flags) && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))) { dump_expr (ob, flags | TFF_EXPR_IN_PARENS); - pp_cxx_arrow (cxx_pp); + if (TREE_CODE (TREE_TYPE (ob)) == REFERENCE_TYPE) + pp_cxx_dot (cxx_pp); + else + pp_cxx_arrow (cxx_pp); } } else diff --git a/gcc/testsuite/g++.dg/cpp0x/error6.C b/gcc/testsuite/g++.dg/cpp0x/error6.C new file mode 100644 index 0000000..482aafb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error6.C @@ -0,0 +1,9 @@ +// PR c++/48284 +// { dg-options -std=c++0x } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" } + +template +auto g(C& c) -> decltype (c.f()) { return c.f(); } // { dg-error "decltype .c\\.f" } +