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 Fri, Nov 16, 2018 at 12:23:42PM +0530, Umesh Kalappa wrote:
> Thank you Marek,Appreciate your valuable feedback on the patch .
> 
> Attached the latest ,please do let us know your thoughts.

Thanks, this version looks good!  Just some small nits:

--- gcc/cp/parser.c	(revision 266026)
+++ gcc/cp/parser.c	(working copy)
@@ -24620,6 +24620,12 @@ cp_parser_noexcept_specification_opt (cp_parser* p
 	{
 	  matching_parens parens;
 	  parens.consume_open (parser);
+ 
+	  tree save_ccp = current_class_ptr;
+	  tree save_ccr = current_class_ref;
+ 
+	  if (current_class_type)
+              inject_this_parameter (current_class_type, TYPE_UNQUALIFIED);
 
This is indented a bit too much: the inject_this_parameter call should be two
spaces to the right of the if.  I.e.:

	  if (current_class_type)
	    inject_this_parameter (current_class_type, TYPE_UNQUALIFIED);

+2018-11-16  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+	PR c++/52869
+	* g++.dg//DRs/dr1207-1.C: New.
+	* g++.dg//DRs/dr1207-2.C: New.

Just one / instead of two.

--- gcc/testsuite/g++.dg/DRs/dr1207-1.C	(nonexistent)
+++ gcc/testsuite/g++.dg/DRs/dr1207-1.C	(working copy)
@@ -0,0 +1,25 @@
+// DR 1207
+// PR c++/52869
+// { dg-do compile { target c++11 } }
+
+struct S {
+    void f() { }
+    void g() noexcept(noexcept(f())) { }
+    void h() noexcept(noexcept(this->f())) { }
+};
+
+struct Nyan {
+	Nyan &operator++() noexcept { return *this; }
+	void omg() noexcept(noexcept(++*this)) {}
+};
+
+template <class T>
+class Test{
+    T count;
+    Test (T arg) {count=arg;}
+    void fetch() { }
+    T inc () noexcept(noexcept(this->fetch())) {return ++count;}
+    T dec () noexcept(noexcept(fetch())) { return --count;} 
+};
+
+

There are two extra newlines you can remove but otherwise the tests look fine now.

I'll let Jason review the last version.  Thanks for contributing to GCC. 

Marek


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