From patchwork Wed Nov 30 23:04:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 128608 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 F1E68B6F68 for ; Thu, 1 Dec 2011 10:06:16 +1100 (EST) Received: (qmail 12684 invoked by alias); 30 Nov 2011 23:06:13 -0000 Received: (qmail 12675 invoked by uid 22791); 30 Nov 2011 23:06:12 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Nov 2011 23:05:58 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pAUN5udR027126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Nov 2011 23:05:57 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pAUN5uvu029918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Nov 2011 23:05:56 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pAUN5onD030344; Wed, 30 Nov 2011 17:05:50 -0600 Received: from [192.168.1.4] (/95.246.209.15) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 Nov 2011 15:05:50 -0800 Message-ID: <4ED6B693.1040808@oracle.com> Date: Thu, 01 Dec 2011 00:04:51 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 51367 X-IsSubscribed: yes 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 Hi, for c++/51230 I tried to change unify_inconsistency to unconditionally use %qE but apparently that doesn't really work: quickly we end up duplicating the whole dump_type inside dump_expr, first POINTER_TYPE (as per this specific PR), and then REFERENCE_TYPE, and then OFFSET_TYPE, and then pointers to member functions are not handled correctly, etc. I guess, better just checking TYPE_P and be done with it. Tested x86_64-linux. Ok? Thanks, Paolo. //////////////////// /cp 2011-11-30 Paolo Carlini PR c++/51367 * pt.c (unify_inconsistency): Use either %qT or %qE depending on whether parm is a type or non-type parameter. /cp 2011-11-30 Paolo Carlini PR c++/51367 * g++.dg/template/error47.C: New. Index: testsuite/g++.dg/template/error47.C =================================================================== --- testsuite/g++.dg/template/error47.C (revision 0) +++ testsuite/g++.dg/template/error47.C (revision 0) @@ -0,0 +1,9 @@ +// PR c++/51367 + +template void foo(T, T); // { dg-message "template" } + +void bar(void* p) +{ + foo(0, p); // { dg-error "no matching" } +} +// { dg-message "candidate|parameter 'T' ('int' and 'void*')" { target *-*-* } 7 } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 181858) +++ cp/pt.c (working copy) @@ -5501,9 +5501,16 @@ static int unify_inconsistency (bool explain_p, tree parm, tree first, tree second) { if (explain_p) - inform (input_location, - " conflicting deductions for parameter %qE (%qE and %qE)", - parm, first, second); + { + if (TYPE_P (parm)) + inform (input_location, + " deduced conflicting types for parameter %qT (%qT and %qT)", + parm, first, second); + else + inform (input_location, + " deduced conflicting values for non-type parameter " + "%qE (%qE and %qE)", parm, first, second); + } return 1; }