From patchwork Mon May 13 19:19:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 243499 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7DE042C0091 for ; Tue, 14 May 2013 05:19:25 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=UApPG1gqwUlHtoIBo6XMX8vn0Q0S9UYHZ+VCLh+x0K3U7D R0oMbp0WIezautaV7lbBRETRTORCajZFw9zi94U9xCIHBj6QngOx+iGNqTwo7czN D/Es8zq/s/4vMTFyOcyKXuo14/W1hqBRsVAJ91yTSG3qaybV6n8xNX79pMxR0= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=Gix2ErUmg4VRXEPOZCxXWHeTHJs=; b=bcf4Utt0Pisz0ysohCeG xRbbGp8AI8fzYTwmZW6EAzBFs/fee1uN8I3LSMtcnTStH983d48Lt/huD+Sb9zmA QtgVZDTMlYZ9l+7wggpNj0xGt5KD5YGLMphwPr5bOnLIt/kfU9SjOkRoc9RSPOGA W9p8vamCtXaxJagWgwZ5CM8= Received: (qmail 13880 invoked by alias); 13 May 2013 19:19:20 -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 13852 invoked by uid 89); 13 May 2013 19:19:15 -0000 X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 19:19:14 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4DJJDct019826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 May 2013 15:19:13 -0400 Received: from [10.3.113.35] (ovpn-113-35.phx2.redhat.com [10.3.113.35]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4DJJCqJ023148 for ; Mon, 13 May 2013 15:19:12 -0400 Message-ID: <51913CB0.8090801@redhat.com> Date: Mon, 13 May 2013 15:19:12 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:22.0) Gecko/20100101 Thunderbird/22.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for 3 ref-qualifier issues X-Virus-Found: No 3 places that hadn't yet been updated to handle ref-qualifiers. Tested x86_64-pc-linux-gnu, applying to trunk and 4.8. commit e4f9e32f7e7b9e508f713ac15a9edbd275d4bd85 Author: Jason Merrill Date: Mon May 13 10:45:41 2013 -0400 PR c++/57252 * decl.c (decls_match): Compare ref-qualifiers. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d8363b2..faa2911 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1024,6 +1024,7 @@ decls_match (tree newdecl, tree olddecl) else types_match = compparms (p1, p2) + && type_memfn_rqual (f1) == type_memfn_rqual (f2) && (TYPE_ATTRIBUTES (TREE_TYPE (newdecl)) == NULL_TREE || comp_type_attributes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)) != 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual10.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual10.C new file mode 100644 index 0000000..1b6c54f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual10.C @@ -0,0 +1,13 @@ +// PR c++/57252 +// { dg-require-effective-target c++11 } + +struct foo { + void bar() & {} + void bar() && {} +}; + +int main() +{ + auto p = &foo::bar; // { dg-error "" } + (foo{}.*p)(); +} commit d6cad04704766c07324719463aac32c1ea428659 Author: Jason Merrill Date: Mon May 13 10:54:47 2013 -0400 PR c++/57253 * decl.c (grokdeclarator): Apply ref-qualifier in the TYPENAME case. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index faa2911..3854135 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10284,7 +10284,7 @@ grokdeclarator (const cp_declarator *declarator, type = void_type_node; } } - else if (memfn_quals) + else if (memfn_quals || rqual) { if (ctype == NULL_TREE && TREE_CODE (type) == METHOD_TYPE) diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual11.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual11.C new file mode 100644 index 0000000..15dd049 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual11.C @@ -0,0 +1,10 @@ +// PR c++/57253 +// { dg-require-effective-target c++11 } + +template struct foo; + +template<> struct foo {}; +template<> struct foo {}; + +int main() +{} commit 1f114e1a2911396b76dfecda214e132e10b41816 Author: Jason Merrill Date: Mon May 13 11:26:25 2013 -0400 PR c++/57254 * typeck.c (merge_types): Propagate ref-qualifier in METHOD_TYPE case. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b8ea555..fb75847 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -851,6 +851,7 @@ merge_types (tree t1, tree t2) tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1), TYPE_RAISES_EXCEPTIONS (t2), NULL_TREE); + cp_ref_qualifier rqual = type_memfn_rqual (t1); tree t3; /* If this was a member function type, get back to the @@ -864,6 +865,7 @@ merge_types (tree t1, tree t2) t3 = build_method_type_directly (basetype, TREE_TYPE (t3), TYPE_ARG_TYPES (t3)); t1 = build_exception_variant (t3, raises); + t1 = build_ref_qualified_type (t1, rqual); break; } diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C new file mode 100644 index 0000000..b0a16fe --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual12.C @@ -0,0 +1,22 @@ +// PR c++/57254 +// { dg-require-effective-target c++11 } + +struct foo { + template + void bar(T) &; + + template + void bar(T) &&; +}; + +template +void foo::bar(T) & {} + +template +void foo::bar(T) && {} + +int main() +{ + foo f; + f.bar(0); +}