[Bug c++/64100] A static assert using the the current class in a noexcept test leads to a segfault
ktietz at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 3 10:38:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64100
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktietz at gcc dot gnu.org
--- Comment #2 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Issue is that lookup_destructor calls adjust_result_of_qualified_name_lookup
with an NULL_TREE decl (returned by lookup_member). Here the error-check seems
to be missing.
Following patch fixes this issue for me:
Index: typeck.c
===================================================================
--- typeck.c (Revision 218142)
+++ typeck.c (Arbeitskopie)
@@ -2536,6 +2536,11 @@ lookup_destructor (tree object, tree scope, tree d
expr = lookup_member (dtor_type, complete_dtor_identifier,
/*protect=*/1, /*want_type=*/false,
tf_warning_or_error);
+ if (!expr)
+ {
+ cxx_incomplete_type_error (dtor_name, dtor_type);
+ return error_mark_node;
+ }
expr = (adjust_result_of_qualified_name_lookup
(expr, dtor_type, object_type));
if (scope == NULL_TREE)
Index: search.c
===================================================================
--- search.c (Revision 218142)
+++ search.c (Arbeitskopie)
@@ -1530,6 +1530,9 @@ adjust_result_of_qualified_name_lookup (tree decl,
tree qualifying_scope,
tree context_class)
{
+ if (!decl)
+ return NULL_TREE;
+
if (context_class && context_class != error_mark_node
&& CLASS_TYPE_P (context_class)
&& CLASS_TYPE_P (qualifying_scope)
The change to search.c isn't really required, but avoids to show the ice in
adjust_result_of_qualifying.
More information about the Gcc-bugs
mailing list