public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7785] c++: Over-zealous assert [PR 99239]
@ 2021-03-23 12:21 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2021-03-23 12:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6acd6692f1ac3c2ece3da36178df73e3b12c4f65

commit r11-7785-g6acd6692f1ac3c2ece3da36178df73e3b12c4f65
Author: Nathan Sidwell <nathan@acm.org>
Date:   Tue Mar 23 05:18:04 2021 -0700

    c++: Over-zealous assert [PR 99239]
    
    This was simply an overzealous assert.  Possibly correct thinking at
    the time that code was written, but not true now.  Of course we can
    have imported artificial decls.
    
            PR c++/99239
            gcc/cp/
            * decl.c (duplicate_decls): Remove assert about maybe-imported
            artificial decls.
            gcc/testsuite/
            * g++.dg/modules/pr99239_a.H: New.
            * g++.dg/modules/pr99239_b.H: New.

Diff:
---
 gcc/cp/decl.c                            |  2 --
 gcc/testsuite/g++.dg/modules/pr99239_a.H | 13 +++++++++++++
 gcc/testsuite/g++.dg/modules/pr99239_b.H | 12 ++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b1d8e444b66..3483b0c0398 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2041,8 +2041,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
     {
       if (DECL_ARTIFICIAL (olddecl))
 	{
-	  gcc_checking_assert (!(DECL_LANG_SPECIFIC (olddecl)
-				 && DECL_MODULE_IMPORT_P (olddecl)));
 	  if (!(global_purview_p () || not_module_p ()))
 	    error ("declaration %qD conflicts with builtin", newdecl);
 	  else
diff --git a/gcc/testsuite/g++.dg/modules/pr99239_a.H b/gcc/testsuite/g++.dg/modules/pr99239_a.H
new file mode 100644
index 00000000000..35f006fe9b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99239_a.H
@@ -0,0 +1,13 @@
+// PR 99239 ICE on catch clause
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+inline void Foo ()
+{
+  try
+    {}
+  catch(...)
+    {
+    }
+}
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99239_b.H b/gcc/testsuite/g++.dg/modules/pr99239_b.H
new file mode 100644
index 00000000000..92638d663c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99239_b.H
@@ -0,0 +1,12 @@
+// { dg-additional-options {-fmodule-header -fno-module-lazy} }
+// { dg-module-cmi {} }
+import  "pr99239_a.H";
+       
+inline void
+  _M_remove_reference() throw()
+{
+  try
+    { }
+  catch(...)
+    { }
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-23 12:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 12:21 [gcc r11-7785] c++: Over-zealous assert [PR 99239] Nathan Sidwell

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).