+2019-11-04 Jason Merrill <jason@redhat.com>
+
+ * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
+
+ * pt.c (maybe_instantiate_noexcept): Only update clones if we
+ instantiated.
+
+ * typeck.c (contextual_conv_bool): New.
+
+ * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
+ C string rather than identifier.
+ * parser.c (cp_parser_userdef_numeric_literal): Use it.
+ * rtti.c (emit_support_tinfos): Use it.
+ * cp-tree.h (ovl_op_identifier): Change to inline functions.
+ (build_x_binary_op): Add wrapper with fewer parms.
+
2019-11-05 Jason Merrill <jason@redhat.com>
* decl2.c (mark_used): Diagnose use of a function with unsatisfied
if (!DECL_DEFAULTED_FN (fun)
&& !LAMBDA_TYPE_P (CP_DECL_CONTEXT (fun))
&& !is_instantiation_of_constexpr (fun))
- return;
+ {
+ inform (DECL_SOURCE_LOCATION (fun), "%qD declared here", fun);
+ return;
+ }
if (diagnosed == NULL)
diagnosed = new hash_set<tree>;
if (diagnosed->add (fun))
then deletes the entire object. */
#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
-#define ovl_op_identifier(ISASS, CODE) (OVL_OP_INFO(ISASS, CODE)->identifier)
-#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier)
-#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier)
/* The name used for conversion operators -- but note that actual
conversion functions use special identifiers outside the identifier
table. */
#define IDENTIFIER_OVL_OP_FLAGS(NODE) \
(IDENTIFIER_OVL_OP_INFO (NODE)->flags)
+inline tree ovl_op_identifier (bool isass, tree_code code)
+{ return OVL_OP_INFO(isass, code)->identifier; }
+inline tree ovl_op_identifier (tree_code code) { return ovl_op_identifier (false, code); }
+#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier)
+#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier)
+
/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
constants. */
extern bool cxx_mark_addressable (tree, bool = false);
extern int string_conv_p (const_tree, const_tree, int);
extern tree cp_truthvalue_conversion (tree);
+extern tree contextual_conv_bool (tree, tsubst_flags_t);
extern tree condition_conversion (tree);
extern tree require_complete_type (tree);
extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
enum tree_code, tree,
enum tree_code, tree *,
tsubst_flags_t);
+inline tree build_x_binary_op (const op_location_t &loc,
+ enum tree_code code, tree arg1, tree arg2,
+ tsubst_flags_t complain)
+{
+ return build_x_binary_op (loc, code, arg1, TREE_CODE (arg1), arg2,
+ TREE_CODE (arg2), NULL, complain);
+}
extern tree build_x_array_ref (location_t, tree, tree,
tsubst_flags_t);
extern tree build_x_unary_op (location_t,
special function creation as necessary. */
tree
-get_class_binding (tree klass, tree name, bool want_type)
+get_class_binding (tree klass, tree name, bool want_type /*=false*/)
{
klass = complete_type (klass);
tree
lookup_qualified_name (tree scope, tree name, int prefer_type, bool complain,
- bool find_hidden)
+ bool find_hidden /*=false*/)
{
tree t = NULL_TREE;
return t;
}
+/* Wrapper for the above that takes a string argument. The function name is
+ not at the beginning of the line to keep this wrapper out of etags. */
+
+tree lookup_qualified_name (tree t, const char *p, int wt, bool c, bool fh)
+{ return lookup_qualified_name (t, get_identifier (p), wt, c, fh); }
+
/* [namespace.qual]
Accepts the NAME to lookup and its qualifying SCOPE.
Returns the name/type pair found into the cxx_binding *RESULT,
{
return get_namespace_binding (NULL_TREE, id);
}
-extern tree lookup_qualified_name (tree, tree, int, bool, /*hidden*/bool = false);
+extern tree lookup_qualified_name (tree, tree, int = 0, bool = true, /*hidden*/bool = false);
+extern tree lookup_qualified_name (tree t, const char *p, int = 0, bool = true, bool = false);
extern tree lookup_name_nonclass (tree);
extern bool is_local_extern (tree);
extern bool pushdecl_class_level (tree);
if (i14 && ext)
{
- tree cxlit = lookup_qualified_name (std_node,
- get_identifier ("complex_literals"),
- 0, false, false);
+ tree cxlit = lookup_qualified_name (std_node, "complex_literals",
+ 0, false);
if (cxlit == error_mark_node)
{
/* No <complex>, so pedwarn and use GNU semantics. */
TREE_TYPE (fn) = build_exception_variant (fntype, spec);
if (orig_fn)
TREE_TYPE (orig_fn) = TREE_TYPE (fn);
- }
- FOR_EACH_CLONE (clone, fn)
- {
- if (TREE_TYPE (clone) == fntype)
- TREE_TYPE (clone) = TREE_TYPE (fn);
- else
- TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
+ FOR_EACH_CLONE (clone, fn)
+ {
+ if (TREE_TYPE (clone) == fntype)
+ TREE_TYPE (clone) = TREE_TYPE (fn);
+ else
+ TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
+ }
}
return true;
/* Look for a defined class. */
tree bltn_type = lookup_qualified_name
- (abi_node, get_identifier ("__fundamental_type_info"), true, false, false);
+ (abi_node, "__fundamental_type_info", true, false);
if (TREE_CODE (bltn_type) != TYPE_DECL)
return;
return c_common_truthvalue_conversion (input_location, expr);
}
+/* Returns EXPR contextually converted to bool. */
+
+tree
+contextual_conv_bool (tree expr, tsubst_flags_t complain)
+{
+ return perform_implicit_conversion_flags (boolean_type_node, expr,
+ complain, LOOKUP_NORMAL);
+}
+
/* Just like cp_truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. This
is a low-level function; most callers should use maybe_convert_cond. */
tree
condition_conversion (tree expr)
{
- tree t;
- t = perform_implicit_conversion_flags (boolean_type_node, expr,
- tf_warning_or_error, LOOKUP_NORMAL);
+ tree t = contextual_conv_bool (expr, tf_warning_or_error);
if (!processing_template_decl)
t = fold_build_cleanup_point_expr (boolean_type_node, t);
return t;
constants. */
bool
-check_narrowing (tree type, tree init, tsubst_flags_t complain, bool const_only)
+check_narrowing (tree type, tree init, tsubst_flags_t complain,
+ bool const_only/*= false*/)
{
tree ftype = unlowered_expr_type (init);
bool ok = true;