[Bug c++/69373] GCC emits incorrect warning that "exception of type ‘void (*)()’ will be caught by earlier handler for 'void*'"
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 9 01:19:28 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69373
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the following patch fixes the warning:
apinski@xeond:~/src/upstream-gcc/gcc/gcc/cp$ git diff except.c
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index a8acbc4b7b2..28d7810e182 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -949,7 +949,8 @@ can_convert_eh (tree to, tree from)
if (! at_least_as_qualified_p (to, from))
return false;
- if (VOID_TYPE_P (to))
+ if (VOID_TYPE_P (to)
+ && TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
return true;
/* Else fall through. */
More information about the Gcc-bugs
mailing list