* PING: [patch] fix c++/33558 - references cannot be mutable
@ 2010-12-22 15:16 Jonathan Wakely
2010-12-22 15:24 ` Jonathan Wakely
2011-01-01 22:34 ` Jonathan Wakely
0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Wakely @ 2010-12-22 15:16 UTC (permalink / raw)
To: gcc-patches
This is a very small patch to fix a standard conformance issue.
I've made it a permerror so broken code can use -fpermissive and
doesn't need to be fixed.
I'd really like to get this in 4.6, so pinging for review
On 18 December 2010 18:57, Jonathan Wakely wrote:
> This is a slightly modified version of the patch attached to PR33558
> which was posted to gcc-patches but apparently never reviewed. I
> don't know if the author of the original patch, Giovanni, has a
> copyright assignment but I think the change is obvious and I hope is
> sufficiently small to not need an assignment. I was in the process of
> making the same change when I found his patch on the PR and copied the
> wording of his diagnostic and testcase.
>
> Sun CC and g++ both incorrectly accept mutable references, so it might
> not be uncommon in the wild (I found a use in some production code
> yesterday.) This version of the patch allows mutable on reference
> members when -fpermissive is used, giving old code a transition path.
> I'll add a note to changes.html if this is approved.
>
> tested x86_64-linux, OK for trunk?
>
>
> cp/ChangeLog entry:
>
> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com>
> Jonathan Wakely <jwakely.gcc@gmail.com>
>
> PR c++/33558
> * decl.c (grokdeclarator): Reject mutable reference members.
>
> testsuite/ChangeLog entry:
>
> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com>
> Jonathan Wakely <jwakely.gcc@gmail.com>
>
> PR c++/33558
> * testsuite/g++.dg/other/pr33558.C: New.
> * testsuite/g++.dg/other/pr33558-2.C: New.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PING: [patch] fix c++/33558 - references cannot be mutable 2010-12-22 15:16 PING: [patch] fix c++/33558 - references cannot be mutable Jonathan Wakely @ 2010-12-22 15:24 ` Jonathan Wakely 2011-01-01 22:34 ` Jonathan Wakely 1 sibling, 0 replies; 5+ messages in thread From: Jonathan Wakely @ 2010-12-22 15:24 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 1832 bytes --] doh, re-attaching the patch would probably help ... On 22 December 2010 14:53, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: > This is a very small patch to fix a standard conformance issue. > > I've made it a permerror so broken code can use -fpermissive and > doesn't need to be fixed. > > I'd really like to get this in 4.6, so pinging for review > > > On 18 December 2010 18:57, Jonathan Wakely wrote: >> This is a slightly modified version of the patch attached to PR33558 >> which was posted to gcc-patches but apparently never reviewed. I >> don't know if the author of the original patch, Giovanni, has a >> copyright assignment but I think the change is obvious and I hope is >> sufficiently small to not need an assignment. I was in the process of >> making the same change when I found his patch on the PR and copied the >> wording of his diagnostic and testcase. >> >> Sun CC and g++ both incorrectly accept mutable references, so it might >> not be uncommon in the wild (I found a use in some production code >> yesterday.) This version of the patch allows mutable on reference >> members when -fpermissive is used, giving old code a transition path. >> I'll add a note to changes.html if this is approved. >> >> tested x86_64-linux, OK for trunk? >> >> >> cp/ChangeLog entry: >> >> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >> Jonathan Wakely <jwakely.gcc@gmail.com> >> >> PR c++/33558 >> * decl.c (grokdeclarator): Reject mutable reference members. >> >> testsuite/ChangeLog entry: >> >> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >> Jonathan Wakely <jwakely.gcc@gmail.com> >> >> PR c++/33558 >> * testsuite/g++.dg/other/pr33558.C: New. >> * testsuite/g++.dg/other/pr33558-2.C: New. >> > [-- Attachment #2: 33558.txt --] [-- Type: text/plain, Size: 1289 bytes --] Index: cp/decl.c =================================================================== --- cp/decl.c (revision 167817) +++ cp/decl.c (working copy) @@ -9210,6 +9210,12 @@ grokdeclarator (const cp_declarator *dec error ("const %qs cannot be declared %<mutable%>", name); storage_class = sc_none; } + else if (TREE_CODE (type) == REFERENCE_TYPE) + { + permerror (input_location, "reference %qs cannot be declared " + "%<mutable%>", name); + storage_class = sc_none; + } } /* If this is declaring a typedef name, return a TYPE_DECL. */ Index: testsuite/g++.dg/other/pr33558.C =================================================================== --- testsuite/g++.dg/other/pr33558.C (revision 0) +++ testsuite/g++.dg/other/pr33558.C (revision 0) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ + +class X { + mutable int &q; /* { dg-error "cannot be declared 'mutable'" } */ +}; Index: testsuite/g++.dg/other/pr33558-2.C =================================================================== --- testsuite/g++.dg/other/pr33558-2.C (revision 0) +++ testsuite/g++.dg/other/pr33558-2.C (revision 0) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-fpermissive" } */ + +class X { + mutable int &q; /* { dg-warning "cannot be declared 'mutable'" } */ +}; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PING: [patch] fix c++/33558 - references cannot be mutable 2010-12-22 15:16 PING: [patch] fix c++/33558 - references cannot be mutable Jonathan Wakely 2010-12-22 15:24 ` Jonathan Wakely @ 2011-01-01 22:34 ` Jonathan Wakely 2011-01-13 22:03 ` Jonathan Wakely 1 sibling, 1 reply; 5+ messages in thread From: Jonathan Wakely @ 2011-01-01 22:34 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 1765 bytes --] On 22 December 2010 14:53, Jonathan Wakely wrote: > This is a very small patch to fix a standard conformance issue. > > I've made it a permerror so broken code can use -fpermissive and > doesn't need to be fixed. > > I'd really like to get this in 4.6, so pinging for review ... again > On 18 December 2010 18:57, Jonathan Wakely wrote: >> This is a slightly modified version of the patch attached to PR33558 >> which was posted to gcc-patches but apparently never reviewed. I >> don't know if the author of the original patch, Giovanni, has a >> copyright assignment but I think the change is obvious and I hope is >> sufficiently small to not need an assignment. I was in the process of >> making the same change when I found his patch on the PR and copied the >> wording of his diagnostic and testcase. >> >> Sun CC and g++ both incorrectly accept mutable references, so it might >> not be uncommon in the wild (I found a use in some production code >> yesterday.) This version of the patch allows mutable on reference >> members when -fpermissive is used, giving old code a transition path. >> I'll add a note to changes.html if this is approved. >> >> tested x86_64-linux, OK for trunk? >> >> >> cp/ChangeLog entry: >> >> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >> Jonathan Wakely <jwakely.gcc@gmail.com> >> >> PR c++/33558 >> * decl.c (grokdeclarator): Reject mutable reference members. >> >> testsuite/ChangeLog entry: >> >> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >> Jonathan Wakely <jwakely.gcc@gmail.com> >> >> PR c++/33558 >> * testsuite/g++.dg/other/pr33558.C: New. >> * testsuite/g++.dg/other/pr33558-2.C: New. >> > [-- Attachment #2: 33558.txt --] [-- Type: text/plain, Size: 1289 bytes --] Index: cp/decl.c =================================================================== --- cp/decl.c (revision 167817) +++ cp/decl.c (working copy) @@ -9210,6 +9210,12 @@ grokdeclarator (const cp_declarator *dec error ("const %qs cannot be declared %<mutable%>", name); storage_class = sc_none; } + else if (TREE_CODE (type) == REFERENCE_TYPE) + { + permerror (input_location, "reference %qs cannot be declared " + "%<mutable%>", name); + storage_class = sc_none; + } } /* If this is declaring a typedef name, return a TYPE_DECL. */ Index: testsuite/g++.dg/other/pr33558.C =================================================================== --- testsuite/g++.dg/other/pr33558.C (revision 0) +++ testsuite/g++.dg/other/pr33558.C (revision 0) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ + +class X { + mutable int &q; /* { dg-error "cannot be declared 'mutable'" } */ +}; Index: testsuite/g++.dg/other/pr33558-2.C =================================================================== --- testsuite/g++.dg/other/pr33558-2.C (revision 0) +++ testsuite/g++.dg/other/pr33558-2.C (revision 0) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-fpermissive" } */ + +class X { + mutable int &q; /* { dg-warning "cannot be declared 'mutable'" } */ +}; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PING: [patch] fix c++/33558 - references cannot be mutable 2011-01-01 22:34 ` Jonathan Wakely @ 2011-01-13 22:03 ` Jonathan Wakely 2011-01-14 2:04 ` Jason Merrill 0 siblings, 1 reply; 5+ messages in thread From: Jonathan Wakely @ 2011-01-13 22:03 UTC (permalink / raw) To: gcc-patches; +Cc: Jason Merrill, Mark Mitchell [-- Attachment #1: Type: text/plain, Size: 2496 bytes --] On 1 January 2011 22:34, Jonathan Wakely wrote: > On 22 December 2010 14:53, Jonathan Wakely wrote: >> This is a very small patch to fix a standard conformance issue. >> >> I've made it a permerror so broken code can use -fpermissive and >> doesn't need to be fixed. >> >> I'd really like to get this in 4.6, so pinging for review > > ... again I'd given up and was going to wait for 4.7, but I have been encouraged to try to get this reviewed again. cp/ChangeLog entry: 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> Jonathan Wakely <jwakely.gcc@gmail.com> PR c++/33558 * decl.c (grokdeclarator): Reject mutable reference members. testsuite/ChangeLog entry: 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> Jonathan Wakely <jwakely.gcc@gmail.com> PR c++/33558 * testsuite/g++.dg/other/pr33558.C: New. * testsuite/g++.dg/other/pr33558-2.C: New. Tested x86_64-linux, ok for trunk? >> On 18 December 2010 18:57, Jonathan Wakely wrote: >>> This is a slightly modified version of the patch attached to PR33558 >>> which was posted to gcc-patches but apparently never reviewed. I >>> don't know if the author of the original patch, Giovanni, has a >>> copyright assignment but I think the change is obvious and I hope is >>> sufficiently small to not need an assignment. I was in the process of >>> making the same change when I found his patch on the PR and copied the >>> wording of his diagnostic and testcase. >>> >>> Sun CC and g++ both incorrectly accept mutable references, so it might >>> not be uncommon in the wild (I found a use in some production code >>> yesterday.) This version of the patch allows mutable on reference >>> members when -fpermissive is used, giving old code a transition path. >>> I'll add a note to changes.html if this is approved. >>> >>> tested x86_64-linux, OK for trunk? >>> >>> >>> cp/ChangeLog entry: >>> >>> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >>> Jonathan Wakely <jwakely.gcc@gmail.com> >>> >>> PR c++/33558 >>> * decl.c (grokdeclarator): Reject mutable reference members. >>> >>> testsuite/ChangeLog entry: >>> >>> 2010-12-18 Giovanni Funchal <gafunchal@gmail.com> >>> Jonathan Wakely <jwakely.gcc@gmail.com> >>> >>> PR c++/33558 >>> * testsuite/g++.dg/other/pr33558.C: New. >>> * testsuite/g++.dg/other/pr33558-2.C: New. >>> >> > [-- Attachment #2: 33558.txt --] [-- Type: text/plain, Size: 1289 bytes --] Index: cp/decl.c =================================================================== --- cp/decl.c (revision 167817) +++ cp/decl.c (working copy) @@ -9210,6 +9210,12 @@ grokdeclarator (const cp_declarator *dec error ("const %qs cannot be declared %<mutable%>", name); storage_class = sc_none; } + else if (TREE_CODE (type) == REFERENCE_TYPE) + { + permerror (input_location, "reference %qs cannot be declared " + "%<mutable%>", name); + storage_class = sc_none; + } } /* If this is declaring a typedef name, return a TYPE_DECL. */ Index: testsuite/g++.dg/other/pr33558.C =================================================================== --- testsuite/g++.dg/other/pr33558.C (revision 0) +++ testsuite/g++.dg/other/pr33558.C (revision 0) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ + +class X { + mutable int &q; /* { dg-error "cannot be declared 'mutable'" } */ +}; Index: testsuite/g++.dg/other/pr33558-2.C =================================================================== --- testsuite/g++.dg/other/pr33558-2.C (revision 0) +++ testsuite/g++.dg/other/pr33558-2.C (revision 0) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-fpermissive" } */ + +class X { + mutable int &q; /* { dg-warning "cannot be declared 'mutable'" } */ +}; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PING: [patch] fix c++/33558 - references cannot be mutable 2011-01-13 22:03 ` Jonathan Wakely @ 2011-01-14 2:04 ` Jason Merrill 0 siblings, 0 replies; 5+ messages in thread From: Jason Merrill @ 2011-01-14 2:04 UTC (permalink / raw) To: Jonathan Wakely; +Cc: gcc-patches, Mark Mitchell OK, sorry for the delay. Jason ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-14 1:24 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-12-22 15:16 PING: [patch] fix c++/33558 - references cannot be mutable Jonathan Wakely 2010-12-22 15:24 ` Jonathan Wakely 2011-01-01 22:34 ` Jonathan Wakely 2011-01-13 22:03 ` Jonathan Wakely 2011-01-14 2:04 ` Jason Merrill
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).