public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 71979
@ 2016-09-22 13:02 Paolo Carlini
  2016-09-22 13:13 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2016-09-22 13:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

in this ICE on invalid [5/6/7] regression the gcc_assert in 
build_base_path is triggered during error recovery when lookup_base 
returns NULL_TREE (makes sense because B is looked up as base of A!). It 
seems to me that we can simply allow for this case in the assertion and 
be done with the issue (should be safe for the release branch too). 
Tested x86_64-linux.

Thanks,

Paolo.

/////////////////////


[-- Attachment #2: CL_71979 --]
[-- Type: text/plain, Size: 260 bytes --]

/cp
2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71979
	* class.c (build_base_path): Allow for lookup_base returning
	NULL_TREE.

/testsuite
2016-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71979
	* g++.dg/cpp0x/pr71979.C: New.

[-- Attachment #3: patch_71979 --]
[-- Type: text/plain, Size: 1330 bytes --]

Index: cp/class.c
===================================================================
--- cp/class.c	(revision 240345)
+++ cp/class.c	(working copy)
@@ -296,12 +296,13 @@ build_base_path (enum tree_code code,
       /* This can happen when adjust_result_of_qualified_name_lookup can't
 	 find a unique base binfo in a call to a member function.  We
 	 couldn't give the diagnostic then since we might have been calling
-	 a static member function, so we do it now.  */
+	 a static member function, so we do it now.  In other cases, eg.
+	 during error recovery (c++/71979), we may not have a base at all.  */
       if (complain & tf_error)
 	{
 	  tree base = lookup_base (probe, BINFO_TYPE (d_binfo),
 				   ba_unique, NULL, complain);
-	  gcc_assert (base == error_mark_node);
+	  gcc_assert (base == error_mark_node || !base);
 	}
       return error_mark_node;
     }
Index: testsuite/g++.dg/cpp0x/pr71979.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr71979.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/pr71979.C	(working copy)
@@ -0,0 +1,15 @@
+// PR c++/71979
+// { dg-do compile { target c++11 } }
+
+struct A
+{ 
+  A & operator= (A &);
+};
+
+struct B : A {};   // { dg-error "cannot bind" }
+
+void foo ()
+{ 
+  B b;
+  b = B ();  // { dg-error "use of deleted" }
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 71979
  2016-09-22 13:02 [C++ Patch] PR 71979 Paolo Carlini
@ 2016-09-22 13:13 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-09-22 13:13 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

On Thu, Sep 22, 2016 at 8:53 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> in this ICE on invalid [5/6/7] regression the gcc_assert in build_base_path
> is triggered during error recovery when lookup_base returns NULL_TREE (makes
> sense because B is looked up as base of A!). It seems to me that we can
> simply allow for this case in the assertion and be done with the issue
> (should be safe for the release branch too). Tested x86_64-linux.
>
> Thanks,
>
> Paolo.
>
> /////////////////////
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-22 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 13:02 [C++ Patch] PR 71979 Paolo Carlini
2016-09-22 13:13 ` 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).