This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug 52869 - [DR 1207] "this" not being allowed in noexcept clauses


On Thu, Nov 15, 2018 at 02:26:24PM +0530, Umesh Kalappa wrote:
> Thank you Marek  for the inputs .
> >>In the future, if using diff, please also use the -p option.
> We are using svn diif  and other comments are addressed .

Thanks, but it doesn't seem like the -p option was used.

> please let us know  your take on the  revised attached patch .


Index: cp/ChangeLog
===================================================================
--- cp/ChangeLog	(revision 266026)
+++ cp/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2018-11-14  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+	PR c++/52869
+	*parser.c () :  restore the old current_class_{ptr,ref} by
+	inject_this_parameter().
+

This is still the same; can you adjust it according to my last suggestion?

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 266026)
+++ cp/parser.c	(working copy)
@@ -24620,6 +24620,12 @@
 	{
 	  matching_parens parens;
 	  parens.consume_open (parser);
+	  
+	  tree save_ccp = current_class_ptr;
+	  tree save_ccr = current_class_ref;
+	  

Watch out for trailing whitespace in the blank lines.

+	  if (current_class_type)
+              inject_this_parameter (current_class_type, TYPE_UNQUALIFIED);
 
I think you can remove the if here.

 	  if (require_constexpr)
 	    {
@@ -24640,6 +24646,9 @@
 	    }
 
 	  parens.require_close (parser);
+
+	  save_ccp = current_class_ptr = save_ccp;
+	  save_ccr = current_class_ref = save_ccr;

You don't need to set save_cc[pr] to itself here.

Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 266026)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2018-11-14  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+	PR c++/52869
+	* g++.dg//DRs/dr52869.C: New.
+

So DR != PR.  Please name the test dr1207.C

Index: testsuite/g++.dg/DRs/dr52869.C
===================================================================
--- testsuite/g++.dg/DRs/dr52869.C	(nonexistent)
+++ testsuite/g++.dg/DRs/dr52869.C	(working copy)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -std=c++11" } */

Instead of this, do:

// { dg-do compile { target c++11 } }

Also, I wrote a test that fails if current_class_{ptr,ref} aren't properly
restored:

// DR 1207
// PR c++/52869
// { dg-do compile { target c++11 } }

void
fn ()
{
  struct S {
    bool operator!() noexcept(false);
  } s;
  S t = s;
}

So you can add that one too, e.g. testsuite/g++.dg/DRs/dr1207-2.C.

Thanks,
Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]