From patchwork Tue May 21 11:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1102699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-501323-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Npx/C36S"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="L9Z6FW7U"; 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 457Xv35Qbhz9s3Z for ; Tue, 21 May 2019 21:03:43 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=hMLwRMxl1WHB+rqsIzgbX95crFd73s/X2wNJkBm2Z7i6dQbPiu Vvo2BDLLi8+/4fFDleDRz1zauJzrFaeOGpH89QqF1hvXDw0nJiqVIzzGz4XAM/eI HF/kLA4bsfBm2Towa7xKJaKh05t5H6BTitfeErXvdi/5LxwmaK3O2TPCM= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=KnasdWuGwIQF5B0fzMA2RsFUEvM=; b=Npx/C36SeOTWTrPHmCfR CIItsmUu4vGhhvygcIVdZtZ6QGLbPpm1Qdn/yNOMC+JB8kRXqQe9mfaJNXlMRrdt 0Gfki4mAxOvdg61m4Sk8xfsQvB+8nFFASz630LcPzIdhc7BzYg6eF3ADU0MGZi/u Mpi8j3N8fDfHKURLLMUrXNg= Received: (qmail 50956 invoked by alias); 21 May 2019 11:03:36 -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 50940 invoked by uid 89); 21 May 2019 11:03:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=ok X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 May 2019 11:03:34 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4LAxOoL076869; Tue, 21 May 2019 11:03:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=duhFLvBARv5pOdwGu0HOXx3EunVVtrIk5GSEuBSk8ps=; b=L9Z6FW7UaMjLDUrQiThcGJdmtcOFc8tj98fkpNku0f6P0ue2Qq+BOmCQ407xjUNCQ7vo kAcmzvyFtaKI44h/yHzHsqH6zsHFtWOowRUVou3NPQBpHK5CO98Yel616Pu5W5Oz2KCk 9tsvtBcFMV3gBVQBT/T7ZODgGTQU2lr0quAJkqhO430ETVjxOFK0Sa4W2fVGRqDw9KGD lO3D3k5iV8dX1RICBPbp5lp+32xaFbaHBVciPpOQmjDJDlY7PvPpPTJ1T1DMU5rtBJyN p38YsXGoIW7V3tfkVif4FxydcnpjCbmHRKKs3F0FUwbjxsXDVSFV63aLL47xWhz+R35L uw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2sj7jdmquc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2019 11:03:32 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4LB2SZ2096687; Tue, 21 May 2019 11:03:31 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2sm046wrfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2019 11:03:31 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4LB3U73011049; Tue, 21 May 2019 11:03:30 GMT Received: from [192.168.1.4] (/79.16.32.200) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 21 May 2019 11:03:29 +0000 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Two literal operator template location fixes Message-ID: Date: Tue, 21 May 2019 13:03:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, also in my back queue a few more location fixes (of course ;) Tested x86_64-linux. Thanks, Paolo. //////////////// /cp 2019-05-21 Paolo Carlini * parser.c (cp_parser_template_declaration_after_parameters): Use DECL_SOURCE_LOCATION in literal operator template errors. /testsuite 2019-05-21 Paolo Carlini * g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: Check locations too. * g++.dg/cpp0x/udlit-tmpl-parms-neg.C: Likewise. Index: cp/parser.c =================================================================== --- cp/parser.c (revision 271459) +++ cp/parser.c (working copy) @@ -27912,14 +27912,16 @@ cp_parser_template_declaration_after_parameters (c if (!ok) { if (cxx_dialect > cxx17) - error ("literal operator template %qD has invalid parameter list;" - " expected non-type template parameter pack %<%> " - "or single non-type parameter of class type", - decl); + error_at (DECL_SOURCE_LOCATION (decl), "literal operator " + "template %qD has invalid parameter list; expected " + "non-type template parameter pack %<%> or " + "single non-type parameter of class type", + decl); else - error ("literal operator template %qD has invalid parameter list;" - " expected non-type template parameter pack %<%>", - decl); + error_at (DECL_SOURCE_LOCATION (decl), "literal operator " + "template %qD has invalid parameter list; expected " + "non-type template parameter pack %<%>", + decl); } } Index: testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C =================================================================== --- testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C (revision 271459) +++ testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C (working copy) @@ -2,6 +2,6 @@ // { dg-do compile { target c++11 } } template // { dg-error "'T' has not been declared" } -int operator"" _foo (); // { dg-error "has invalid parameter list" } +int operator"" _foo (); // { dg-error "5:literal operator template .int operator\"\"_foo\\(\\). has invalid parameter list" } template // { dg-error "'T' has not been declared" } -int operator"" _bar (); // { dg-error "has invalid parameter list" } +int operator"" _bar (); // { dg-error "5:literal operator template .int operator\"\"_bar\\(\\). has invalid parameter list" } Index: testsuite/g++.dg/cpp0x/udlit-tmpl-parms-neg.C =================================================================== --- testsuite/g++.dg/cpp0x/udlit-tmpl-parms-neg.C (revision 271459) +++ testsuite/g++.dg/cpp0x/udlit-tmpl-parms-neg.C (working copy) @@ -3,10 +3,10 @@ class Foo { }; template - Foo operator"" _Foo(); // { dg-error "literal operator template|has invalid parameter list" } + Foo operator"" _Foo(); // { dg-error "7:literal operator template .Foo operator\"\"_Foo\\(\\). has invalid parameter list" } template - Foo operator"" _Bar(); // { dg-error "literal operator template|has invalid parameter list" } + Foo operator"" _Bar(); // { dg-error "7:literal operator template .Foo operator\"\"_Bar\\(\\). has invalid parameter list" } template - Foo operator"" _Bar(); // { dg-error "literal operator template|has invalid parameter list" } + Foo operator"" _Bar(); // { dg-error "7:literal operator template .Foo operator\"\"_Bar\\(\\). has invalid parameter list" }