+2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/81054
+ * constexpr.c (ensure_literal_type_for_constexpr_object): Return
+ error_mark_node when we give an error.
+ * decl.c (cp_finish_decl): Use the latter.
+
2018-01-17 Nathan Sidwell <nathan@acm.org>
PR c++/83287
}
/* If DECL is a variable declared `constexpr', require its type
- be literal. Return the DECL if OK, otherwise NULL. */
+ be literal. Return error_mark_node if we give an error, the
+ DECL otherwise. */
tree
ensure_literal_type_for_constexpr_object (tree decl)
error ("the type %qT of %<constexpr%> variable %qD "
"is not literal", type, decl);
explain_non_literal_class (type);
+ decl = error_mark_node;
}
else
{
error ("variable %qD of non-literal type %qT in %<constexpr%> "
"function", decl, type);
explain_non_literal_class (type);
+ decl = error_mark_node;
}
cp_function_chain->invalid_constexpr = true;
}
- return NULL;
}
}
return decl;
cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
}
- if (!ensure_literal_type_for_constexpr_object (decl))
- DECL_DECLARED_CONSTEXPR_P (decl) = 0;
+ if (ensure_literal_type_for_constexpr_object (decl)
+ == error_mark_node)
+ {
+ DECL_DECLARED_CONSTEXPR_P (decl) = 0;
+ return;
+ }
if (VAR_P (decl)
&& DECL_CLASS_SCOPE_P (decl)