]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Over-zealous assert [PR 99239]
authorNathan Sidwell <nathan@acm.org>
Tue, 23 Mar 2021 12:18:04 +0000 (05:18 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 23 Mar 2021 12:21:13 +0000 (05:21 -0700)
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.

gcc/cp/decl.c
gcc/testsuite/g++.dg/modules/pr99239_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99239_b.H [new file with mode: 0644]

index b1d8e444b66ed2ac1a3e2e38d2cd3f63b14dcf9b..3483b0c039835d45bcf7a6c5c3f116ee121c5e82 100644 (file)
@@ -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 (file)
index 0000000..35f006f
--- /dev/null
@@ -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 (file)
index 0000000..92638d6
--- /dev/null
@@ -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(...)
+    { }
+}