public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Umesh Kalappa <umesh.kalappa0@gmail.com>
To: polacek@redhat.com
Cc: jason@redhat.com, gcc-patches@gcc.gnu.org
Subject: Re: Bug 52869 - [DR 1207] "this" not being allowed in noexcept clauses
Date: Wed, 14 Nov 2018 16:25:00 -0000	[thread overview]
Message-ID: <CAGfacvQaaayRA_+sr4-Ldu2Xb0oss8=J-vxjinphXjE3vf+JsA@mail.gmail.com> (raw)
In-Reply-To: <20181114143348.GH28582@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

My bad Marek and thank you for pointing that out.

Please find the attached correct one (pr52869.patch) .

~Umesh

[-- Attachment #2: pr52869.patch --]
[-- Type: application/octet-stream, Size: 2421 bytes --]

Index: gcc/cp/ChangeLog
===================================================================
--- gcc/cp/ChangeLog	(revision 266026)
+++ gcc/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().
+
 2018-11-09  Jakub Jelinek  <jakub@redhat.com>
 
 	* parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 266026)
+++ gcc/cp/parser.c	(working copy)
@@ -24615,11 +24615,24 @@
     {
       tree expr;
       cp_lexer_consume_token (parser->lexer);
-
+   
       if (cp_lexer_peek_token (parser->lexer)->type == CPP_OPEN_PAREN)
 	{
 	  matching_parens parens;
 	  parens.consume_open (parser);
+	  
+	  if (current_class_type)
+              inject_this_parameter (current_class_type, TYPE_UNQUALIFIED);
+          else
+            {
+              /*clear the current_class_ptr for non class type , like 
+		int foo() noexcept(*this)
+		{		
+		  return 1;
+		}	
+	      */
+                current_class_ptr = NULL_TREE;
+            }
 
 	  if (require_constexpr)
 	    {
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 266026)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2018-11-14  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+	PR g++.dg/52869
+	* g++.dg/pr52869.C: New.
+
 2018-11-11  Xianmiao Qu  <xianmiao_qu@c-sky.com>
 
 	* gcc.target/csky/fnmul-1.c: New.
Index: gcc/testsuite/g++.dg/pr52869.C
===================================================================
--- gcc/testsuite/g++.dg/pr52869.C	(nonexistent)
+++ gcc/testsuite/g++.dg/pr52869.C	(working copy)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -g" } */
+
+struct S {
+    void f() { }
+    void g() noexcept(noexcept(f())) { }
+    void h() noexcept(noexcept(this->f())) { }
+};
+
+struct Nyan {
+	constexpr Nyan &operator++() noexcept { return *this; }
+	constexpr void omg() noexcept(noexcept(++*this)) {}
+};
+
+template< typename T >
+T sine( T const& a, T const& b ) noexcept
+{
+    static_assert( noexcept( T(a / sqrt(a * a  + b * b)) ), "throwing expr" );
+    return a / sqrt(a * a  + b * b);
+}
+
+int foo() noexcept
+{
+  return 1;
+}
+

  reply	other threads:[~2018-11-14 16:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  6:20 Umesh Kalappa
2018-11-13 15:40 ` Marek Polacek
2018-11-13 21:25   ` Jason Merrill
2018-11-14 11:49     ` Umesh Kalappa
2018-11-14 13:23       ` Umesh Kalappa
2018-11-14 14:33       ` Marek Polacek
2018-11-14 16:25         ` Umesh Kalappa [this message]
2018-11-14 18:53           ` Marek Polacek
2018-11-15  8:56             ` Umesh Kalappa
2018-11-15 15:56               ` Marek Polacek
2018-11-15 15:59                 ` Marek Polacek
2018-11-16  6:53                 ` Umesh Kalappa
2018-11-16 18:18                   ` Marek Polacek
2018-11-16 21:55                     ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGfacvQaaayRA_+sr4-Ldu2Xb0oss8=J-vxjinphXjE3vf+JsA@mail.gmail.com' \
    --to=umesh.kalappa0@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).