* tree.c (cp_expr_location): New.
* cp-tree.h (cp_expr_loc_or_loc): New.
* call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
From-SVN: r261728
2018-06-18 Jason Merrill <jason@redhat.com>
+ * tree.c (cp_expr_location): New.
+ * cp-tree.h (cp_expr_loc_or_loc): New.
+ * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
+ error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
+ typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
+
* parser.c (cp_parser_lambda_expression): Use a range for
LAMBDA_EXPR_LOCATION.
conversion *conv;
void *p;
tree t;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (error_operand_p (expr))
return error_mark_node;
if (complain & tf_error)
{
if (VOID_TYPE_P (arg2_type))
- error_at (EXPR_LOC_OR_LOC (arg3, loc),
+ error_at (cp_expr_loc_or_loc (arg3, loc),
"second operand to the conditional operator "
"is of type %<void%>, but the third operand is "
"neither a throw-expression nor of type %<void%>");
else
- error_at (EXPR_LOC_OR_LOC (arg2, loc),
+ error_at (cp_expr_loc_or_loc (arg2, loc),
"third operand to the conditional operator "
"is of type %<void%>, but the second operand is "
"neither a throw-expression nor of type %<void%>");
tree totype = convs->type;
diagnostic_t diag_kind;
int flags;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (convs->bad_p && !(complain & tf_error))
return error_mark_node;
convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
{
tree arg_type;
- location_t loc = EXPR_LOC_OR_LOC (arg, input_location);
+ location_t loc = cp_expr_loc_or_loc (arg, input_location);
/* [expr.call]
"argument of function call might be a candidate "
"for a format attribute");
}
- maybe_warn_parm_abi (type, EXPR_LOC_OR_LOC (val, input_location));
+ maybe_warn_parm_abi (type, cp_expr_loc_or_loc (val, input_location));
}
return val;
}
tree type = TREE_TYPE (to);
tree as_base = CLASSTYPE_AS_BASE (type);
tree arg = argarray[1];
- location_t loc = EXPR_LOC_OR_LOC (arg, input_location);
+ location_t loc = cp_expr_loc_or_loc (arg, input_location);
if (is_really_empty_class (type))
{
tree fndecl;
/* Remember roughly where this call is. */
- location_t loc = EXPR_LOC_OR_LOC (fn, input_location);
+ location_t loc = cp_expr_loc_or_loc (fn, input_location);
fn = build_call_a (fn, nargs, argarray);
SET_EXPR_LOCATION (fn, loc);
{
conversion *conv;
void *p;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (TYPE_REF_P (type))
expr = mark_lvalue_use (expr);
{
conversion *conv;
void *p;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (type == error_mark_node || error_operand_p (expr))
return error_mark_node;
default:
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"call to internal function %qE", t);
*non_constant_p = true;
return t;
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
{
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ location_t loc = cp_expr_loc_or_loc (t, input_location);
tree type = TREE_TYPE (TREE_TYPE (t));
tree result = fold_binary_loc (loc, opcode, type,
fold_convert_loc (loc, type, arg0),
bool lval,
bool *non_constant_p, bool *overflow_p)
{
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ location_t loc = cp_expr_loc_or_loc (t, input_location);
tree fun = get_function_named_in_call (t);
constexpr_call new_call = { NULL, NULL, NULL, 0 };
bool depth_ok;
if (++count >= constexpr_loop_limit)
{
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"%<constexpr%> loop iteration count exceeds limit of %d "
"(use -fconstexpr-loop-limit= to increase the limit)",
constexpr_loop_limit);
if (REINTERPRET_CAST_P (t))
{
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"a reinterpret_cast is not a constant expression");
*non_constant_p = true;
return t;
if (TYPE_REF_P (type))
{
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"dereferencing a null pointer");
*non_constant_p = true;
return t;
if (!can_convert (type, from, tf_none))
{
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"conversion of %qT null pointer to %qT "
"is not a constant expression",
from, type);
reinterpret_cast<void*>(sizeof 0)
*/
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"%<reinterpret_cast<%T>(%E)%> is not "
"a constant expression",
type, op);
case BASELINK:
case OFFSET_REF:
if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"expression %qE is not a constant expression", t);
*non_constant_p = true;
break;
return false;
if (t == NULL_TREE)
return true;
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ location_t loc = cp_expr_loc_or_loc (t, input_location);
if (TREE_THIS_VOLATILE (t) && !DECL_P (t))
{
if (flags & tf_error)
if (DECL_OVERLOADED_OPERATOR_P (fn))
{
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ location_t loc = cp_expr_loc_or_loc (t, input_location);
error_at (loc, "constraint %qE, uses overloaded operator", t);
return true;
}
tree type = cv_unqualified (TREE_TYPE (expr));
if (!same_type_p (type, boolean_type_node))
{
- error_at (EXPR_LOC_OR_LOC (expr, input_location),
+ error_at (cp_expr_loc_or_loc (expr, input_location),
"constraint %qE does not have type %qT",
expr, boolean_type_node);
return boolean_false_node;
{
/* If COND is constant, don't bother building an exit. If it's false,
we won't build a loop. If it's true, any exits are in the body. */
- location_t cloc = EXPR_LOC_OR_LOC (cond, start_locus);
+ location_t cloc = cp_expr_loc_or_loc (cond, start_locus);
exit = build1_loc (cloc, GOTO_EXPR, void_type_node,
get_bc_label (bc_break));
exit = fold_build3_loc (cloc, COND_EXPR, void_type_node, cond,
cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
int saved_stmts_are_full_exprs_p = 0;
- location_t loc = EXPR_LOC_OR_LOC (*expr_p, input_location);
+ location_t loc = cp_expr_loc_or_loc (*expr_p, input_location);
enum tree_code code = TREE_CODE (*expr_p);
enum gimplify_status ret;
but not all node kinds do (e.g. constants, and references to
params, locals, etc), so we stash a copy here. */
+extern location_t cp_expr_location (const_tree);
+
class cp_expr
{
public:
m_value (NULL), m_loc (UNKNOWN_LOCATION) {}
cp_expr (tree value) :
- m_value (value), m_loc (EXPR_LOCATION (m_value)) {}
+ m_value (value), m_loc (cp_expr_location (m_value)) {}
cp_expr (tree value, location_t loc):
m_value (value), m_loc (loc) {}
extern void require_complete_eh_spec_types (tree, tree);
extern void cxx_incomplete_type_diagnostic (location_t, const_tree,
const_tree, diagnostic_t);
+
+inline location_t
+cp_expr_loc_or_loc (const_tree t, location_t or_loc)
+{
+ location_t loc = cp_expr_location (t);
+ if (loc == UNKNOWN_LOCATION)
+ loc = or_loc;
+ return loc;
+}
+
inline void
cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
diagnostic_t diag_kind)
{
- cxx_incomplete_type_diagnostic (EXPR_LOC_OR_LOC (value, input_location),
+ cxx_incomplete_type_diagnostic (cp_expr_loc_or_loc (value, input_location),
value, type, diag_kind);
}
tree intype = TREE_TYPE (expr);
enum tree_code form;
tree rval;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (intype == error_mark_node)
return error_mark_node;
tree rval = NULL_TREE;
tree rval_as_conversion = NULL_TREE;
bool can_convert_intype_to_type;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (TREE_CODE (type) == FUNCTION_TYPE
&& TREE_TYPE (expr) == unknown_type_node)
folded_result = fold_simple (folded_result);
if (!TREE_OVERFLOW_P (folded)
&& folded_result != error_mark_node)
- warnings_for_convert_and_check (EXPR_LOC_OR_LOC (expr, input_location),
+ warnings_for_convert_and_check (cp_expr_loc_or_loc (expr, input_location),
type, folded, folded_result);
}
enum tree_code code = TREE_CODE (type);
const char *invalid_conv_diag;
tree e1;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
bool dofold = (convtype & CONV_FOLD);
if (error_operand_p (e) || type == error_mark_node)
tree call = expr;
if (TREE_CODE (expr) == TARGET_EXPR)
call = TARGET_EXPR_INITIAL (expr);
- location_t loc = EXPR_LOC_OR_LOC (call, input_location);
+ location_t loc = cp_expr_loc_or_loc (call, input_location);
tree callee = cp_get_callee (call);
if (!callee)
return;
tree
convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
{
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
if (expr == error_mark_node
|| TREE_TYPE (expr) == error_mark_node)
location_t switch_location;
/* Emit warnings as needed. */
- switch_location = EXPR_LOC_OR_LOC (cs->switch_stmt, input_location);
+ switch_location = cp_expr_loc_or_loc (cs->switch_stmt, input_location);
const bool bool_cond_p
= (SWITCH_STMT_TYPE (cs->switch_stmt)
&& TREE_CODE (SWITCH_STMT_TYPE (cs->switch_stmt)) == BOOLEAN_TYPE);
do_default);
if (failure == 1)
{
- error_at (EXPR_LOC_OR_LOC (initializer,
+ error_at (cp_expr_loc_or_loc (initializer,
DECL_SOURCE_LOCATION (decl)),
"initializer fails to determine size of %qD", decl);
}
}
else if (init_len != 1 && TREE_CODE (type) != COMPLEX_TYPE)
{
- error_at (EXPR_LOC_OR_LOC (init, DECL_SOURCE_LOCATION (decl)),
+ error_at (cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (decl)),
"scalar object %qD requires one element in "
"initializer", decl);
TREE_TYPE (decl) = error_mark_node;
{
/* Don't reshape if the class has constructors. */
if (cxx_dialect == cxx98)
- error_at (EXPR_LOC_OR_LOC (init, DECL_SOURCE_LOCATION (decl)),
+ error_at (cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (decl)),
"in C++98 %qD must be initialized by "
"constructor, not by %<{...}%>",
decl);
&& DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
&& PAREN_STRING_LITERAL_P (DECL_INITIAL (decl)))
- warning_at (EXPR_LOC_OR_LOC (DECL_INITIAL (decl),
+ warning_at (cp_expr_loc_or_loc (DECL_INITIAL (decl),
DECL_SOURCE_LOCATION (decl)),
0, "array %qD initialized by parenthesized "
"string literal %qE",
return DECL_SOURCE_LOCATION (t);
if (TREE_CODE (t) == DEFAULT_ARG)
return defarg_location (t);
- return EXPR_LOC_OR_LOC (t, input_location);
+ return cp_expr_loc_or_loc (t, input_location);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
{
init = DECL_INITIAL (DECL_TI_TEMPLATE (member));
location_t expr_loc
- = EXPR_LOC_OR_LOC (init, DECL_SOURCE_LOCATION (member));
+ = cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (member));
tree *slot;
if (TREE_CODE (init) == DEFAULT_ARG)
/* Unparsed. */;
if (!begin)
return;
- location_t loc = EXPR_LOC_OR_LOC (init, input_location);
+ location_t loc = cp_expr_loc_or_loc (init, input_location);
warning_at (loc, OPT_Winit_list_lifetime,
"initializing %qD from %qE does not extend the lifetime "
"of the underlying array", member, begin);
return error_mark_node;
location_t init_loc = (init
- ? EXPR_LOC_OR_LOC (init, input_location)
+ ? cp_expr_loc_or_loc (init, input_location)
: location_of (exp));
TREE_READONLY (exp) = 0;
static void
warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
{
- location_t loc = EXPR_LOC_OR_LOC (oper, input_location);
+ location_t loc = cp_expr_loc_or_loc (oper, input_location);
/* The number of bytes to add to or subtract from the size of the provided
buffer based on an offset into an array or an array element reference.
{
if (complain & tf_error)
{
- error_at (EXPR_LOC_OR_LOC (inner_nelts, input_location),
+ error_at (cp_expr_loc_or_loc (inner_nelts, input_location),
"array size in new-expression must be constant");
cxx_constant_value(inner_nelts);
}
{
if (complain & tf_warning_or_error)
{
- pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), OPT_Wvla,
+ pedwarn (cp_expr_loc_or_loc (outer_nelts, input_location), OPT_Wvla,
typedef_variant_p (orig_type)
? G_("non-constant array new length must be specified "
"directly, not by typedef")
tree obase = base;
bool xvalue = false;
bool errors = false;
- location_t loc = (init ? EXPR_LOC_OR_LOC (init, input_location)
+ location_t loc = (init ? cp_expr_loc_or_loc (init, input_location)
: location_of (base));
if (TREE_CODE (atype) == ARRAY_TYPE && TYPE_DOMAIN (atype))
unqualified_name_lookup_error (tree name, location_t loc)
{
if (loc == UNKNOWN_LOCATION)
- loc = EXPR_LOC_OR_LOC (name, input_location);
+ loc = cp_expr_loc_or_loc (name, input_location);
if (IDENTIFIER_ANY_OP_P (name))
error_at (loc, "%qD not defined", name);
{
if (IDENTIFIER_MARKED (designator))
{
- error_at (EXPR_LOC_OR_LOC (val, input_location),
+ error_at (cp_expr_loc_or_loc (val, input_location),
"%<.%s%> designator used multiple times in "
"the same initializer list",
IDENTIFIER_POINTER (designator));
|| CLASS_TYPE_P (TREE_TYPE (decl))))
return cond;
- return build_x_binary_op (EXPR_LOC_OR_LOC (cond, input_location),
+ return build_x_binary_op (cp_expr_loc_or_loc (cond, input_location),
TREE_CODE (cond),
TREE_OPERAND (cond, 0), ERROR_MARK,
TREE_OPERAND (cond, 1), ERROR_MARK,
if (parameter_packs)
{
if (loc == UNKNOWN_LOCATION)
- loc = EXPR_LOC_OR_LOC (t, input_location);
+ loc = cp_expr_loc_or_loc (t, input_location);
error_at (loc, "parameter packs not expanded with %<...%>:");
while (parameter_packs)
{
check_valid_ptrmem_cst_expr (tree type, tree expr,
tsubst_flags_t complain)
{
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
tree orig_expr = expr;
STRIP_NOPS (expr);
if (null_ptr_cst_p (expr))
tree from_type, tree arg)
{
if (explain_p)
- inform (EXPR_LOC_OR_LOC (arg, input_location),
+ inform (cp_expr_loc_or_loc (arg, input_location),
" cannot convert %qE (type %qT) to type %qT",
arg, from_type, to_type);
return unify_invalid (explain_p);
convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
{
tree expr_type;
- location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ location_t loc = cp_expr_loc_or_loc (expr, input_location);
tree orig_expr = expr;
/* Detect immediately string literals as invalid non-type argument.
return t;
loc = input_location;
- if (EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
+ if (location_t eloc = cp_expr_location (t))
+ input_location = eloc;
if (STATEMENT_CODE_P (TREE_CODE (t)))
current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
return t;
loc = input_location;
- if (EXPR_HAS_LOCATION (t))
- input_location = EXPR_LOCATION (t);
+ if (location_t eloc = cp_expr_location (t))
+ input_location = eloc;
/* N3276 decltype magic only applies to calls at the top level or on the
right side of a comma. */
bool diag = true;
if (in_lambda)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
msg, function);
else
- diag = permerror (EXPR_LOC_OR_LOC (t, input_location),
+ diag = permerror (cp_expr_loc_or_loc (t, input_location),
msg, function);
if (diag)
{
/* Can't say anything more. */;
else if (DECL_CLASS_SCOPE_P (fn))
{
- location_t loc = EXPR_LOC_OR_LOC (t,
+ location_t loc = cp_expr_loc_or_loc (t,
input_location);
inform (loc,
"declarations in dependent base %qT are "
gcc_assert (nargs == 1);
if (vec_safe_length (call_args) != 1)
{
- error_at (EXPR_LOC_OR_LOC (t, input_location),
+ error_at (cp_expr_loc_or_loc (t, input_location),
"wrong number of arguments to "
"%<__builtin_launder%>");
ret = error_mark_node;
}
else
- ret = finish_builtin_launder (EXPR_LOC_OR_LOC (t,
+ ret = finish_builtin_launder (cp_expr_loc_or_loc (t,
input_location),
(*call_args)[0], complain);
break;
else if (!(added = !fns->add (fn)))
{
/* If hash_set::add returns true, the element was already there. */
- location_t loc = EXPR_LOC_OR_LOC (DEFERRED_NOEXCEPT_PATTERN (noex),
+ location_t loc = cp_expr_loc_or_loc (DEFERRED_NOEXCEPT_PATTERN (noex),
DECL_SOURCE_LOCATION (fn));
error_at (loc,
"exception specification of %qD depends on itself",
[temp.names]: In a qualified-id of a declarator-id, the keyword
template shall not appear at the top level. */
- pedwarn (EXPR_LOC_OR_LOC (fullname, input_location), OPT_Wpedantic,
+ pedwarn (cp_expr_loc_or_loc (fullname, input_location), OPT_Wpedantic,
"keyword %<template%> not allowed in declarator-id");
tmpl = decl;
}
&& !TREE_NO_WARNING (cond)
&& warn_parentheses)
{
- warning_at (EXPR_LOC_OR_LOC (cond, input_location), OPT_Wparentheses,
+ warning_at (cp_expr_loc_or_loc (cond, input_location), OPT_Wparentheses,
"suggest parentheses around assignment used as truth value");
TREE_NO_WARNING (cond) = 1;
}
|| any_type_dependent_arguments_p (*args))
{
result = build_min_nt_call_vec (orig_fn, *args);
- SET_EXPR_LOCATION (result, EXPR_LOC_OR_LOC (fn, input_location));
+ SET_EXPR_LOCATION (result, cp_expr_loc_or_loc (fn, input_location));
KOENIG_LOOKUP_P (result) = koenig_p;
if (is_overloaded_fn (fn))
{
return error_mark_node;
}
t = build4 (TARGET_EXPR, type, decl, value, t, NULL_TREE);
- if (EXPR_HAS_LOCATION (value))
- SET_EXPR_LOCATION (t, EXPR_LOCATION (value));
+ if (location_t eloc = cp_expr_location (value))
+ SET_EXPR_LOCATION (t, eloc);
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not
ignore the TARGET_EXPR. If there really turn out to be no
side-effects, then the optimizer should be able to get rid of
}
}
+/* Like EXPR_LOCATION, but also handle some tcc_exceptional that have
+ locations. */
+
+location_t
+cp_expr_location (const_tree t_)
+{
+ tree t = CONST_CAST_TREE (t_);
+ if (t == NULL_TREE)
+ return UNKNOWN_LOCATION;
+ switch (TREE_CODE (t))
+ {
+ case LAMBDA_EXPR:
+ return LAMBDA_EXPR_LOCATION (t);
+ case STATIC_ASSERT:
+ return STATIC_ASSERT_SOURCE_LOCATION (t);
+ default:
+ return EXPR_LOCATION (t);
+ }
+}
+
/* Implement -Wzero_as_null_pointer_constant. Return true if the
conditions for the warning hold, false otherwise. */
bool
{
tree type;
enum tree_code code;
- location_t loc = EXPR_LOC_OR_LOC (exp, input_location);
+ location_t loc = cp_expr_loc_or_loc (exp, input_location);
type = TREE_TYPE (exp);
if (type == error_mark_node)
rationalize_conditional_expr (enum tree_code code, tree t,
tsubst_flags_t complain)
{
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ location_t loc = cp_expr_loc_or_loc (t, input_location);
/* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
the first operand is always the one to be used if both operands
{
/* No default_conversion here. It causes trouble for ADDR_EXPR. */
tree arg = xarg;
- location_t location = EXPR_LOC_OR_LOC (arg, input_location);
+ location_t location = cp_expr_loc_or_loc (arg, input_location);
tree argtype = 0;
const char *errstring = NULL;
tree val;
&& !CONSTRUCTOR_IS_DIRECT_INIT (expr))
{
if (complain & tf_error)
- pedwarn (EXPR_LOC_OR_LOC (expr, input_location), 0,
+ pedwarn (cp_expr_loc_or_loc (expr, input_location), 0,
"list-initializer for non-class type must not "
"be parenthesized");
else
}
else if (fndecl)
{
- error_at (EXPR_LOC_OR_LOC (rhs, input_location),
+ error_at (cp_expr_loc_or_loc (rhs, input_location),
"cannot convert %qH to %qI",
rhstype, type);
inform (get_fndecl_argument_location (fndecl, parmnum),
&& TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
&& (complain & tf_warning))
{
- location_t loc = EXPR_LOC_OR_LOC (rhs, input_location);
+ location_t loc = cp_expr_loc_or_loc (rhs, input_location);
warning_at (loc, OPT_Wparentheses,
"suggest parentheses around assignment used as truth value");
{
tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl));
tree whats_returned = fold_for_warn (retval);
- location_t loc = EXPR_LOC_OR_LOC (retval, input_location);
+ location_t loc = cp_expr_loc_or_loc (retval, input_location);
for (;;)
{
if (!ok)
{
- location_t loc = EXPR_LOC_OR_LOC (init, input_location);
+ location_t loc = cp_expr_loc_or_loc (init, input_location);
if (cxx_dialect == cxx98)
{
if (complain & tf_warning)
if (TREE_CODE (init) == NON_LVALUE_EXPR)
init = TREE_OPERAND (init, 0);
- location_t loc = EXPR_LOC_OR_LOC (init, input_location);
+ location_t loc = cp_expr_loc_or_loc (init, input_location);
/* Initialization of an array of chars from a string constant. The initializer
can be optionally enclosed in braces, but reshape_init has already removed
if (nested == 2 && !domain && !vec_safe_is_empty (v))
{
if (complain & tf_error)
- error_at (EXPR_LOC_OR_LOC (init, input_location),
+ error_at (cp_expr_loc_or_loc (init, input_location),
"initialization of flexible array member "
"in a nested context");
return PICFLAG_ERRONEOUS;
template<typename ... Args>
static void foo()
{
- [](Args, int x) {
+ [](Args, int x) { // { dg-error "packs not expanded" }
x;
- }; // { dg-error "packs not expanded" }
+ };
}
int main()
{