typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter and use it throughout.
/gcc/cp 2019-12-18 Paolo Carlini <paolo.carlini@oracle.com> * typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter and use it throughout. (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (cxx_sizeof_or_alignof_expr): Likewise. (cxx_alignas_expr): Update call. * decl.c (fold_sizeof_expr): Likewise. * pt.c (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * except.c (build_throw): Add location_t parameter and use it. (expand_end_catch_block): Update call. * parser.c (cp_parser_unary_expression): Update cxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls, pass the compound location. (cp_parser_throw_expression): Likewise pass the combined location to build_throw. * cp-tree.h: Update declarations. * semantics.c (finish_handler_parms): Use DECL_SOURCE_LOCATION. * decl2.c (check_classfn): Likewise. * except.c (is_admissible_throw_operand_or_catch_parameter): Exploit cp_expr_loc_or_input_loc in one place. * except.c (create_try_catch_expr): Remove, unused. /libcc1 2019-12-18 Paolo Carlini <paolo.carlini@oracle.com> * libcp1plugin.cc (plugin_build_unary_expr): Update build_throw and cxx_sizeof_or_alignof_expr calls. (plugin_build_unary_type_expr): Likewise for cxx_sizeof_or_alignof_type. /gcc/testsuite 2019-12-18 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/alignof2.C: New. * g++.dg/diagnostic/alignof3.C: Likewise. * g++.dg/diagnostic/incomplete-type-1.C: Likewise. * g++.dg/warn/Wcatch-value-3b.C: Likewise. * g++.dg/cpp0x/alignof3.C: Check location(s) too. * g++.dg/cpp1z/decomp-bitfield1.C: Likewise. * g++.dg/cpp1z/has-unique-obj-representations2.C: Likewise. * g++.dg/expr/sizeof3.C: Likewise. * g++.dg/ext/flexary6.C: Likewise. * g++.dg/ext/vla4.C: Likewise. * g++.dg/template/sizeof11.C: Likewise. * g++.dg/warn/Wcatch-value-1.C: Likewise. * g++.dg/warn/Wcatch-value-2.C: Likewise. * g++.dg/warn/Wcatch-value-3.C: Likewise. * g++.old-deja/g++.brendan/sizeof1.C: Likewise. * g++.old-deja/g++.brendan/sizeof3.C: Likewise. * g++.old-deja/g++.brendan/sizeof4.C: Likewise. * g++.old-deja/g++.eh/ctor1.C: Likewise. * g++.old-deja/g++.jason/ambig1.C: Likewise. * g++.old-deja/g++.other/sizeof4.C: Likewise. From-SVN: r279543
This commit is contained in:
parent
a7389ce5d4
commit
d3769410c6
@ -1,3 +1,31 @@
|
||||
2019-12-18 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter
|
||||
and use it throughout.
|
||||
(cxx_sizeof_expr): Likewise.
|
||||
(cxx_alignof_expr): Likewise.
|
||||
(cxx_sizeof_or_alignof_expr): Likewise.
|
||||
(cxx_alignas_expr): Update call.
|
||||
* decl.c (fold_sizeof_expr): Likewise.
|
||||
* pt.c (tsubst_copy): Likewise.
|
||||
(tsubst_copy_and_build): Likewise.
|
||||
* except.c (build_throw): Add location_t parameter and use it.
|
||||
(expand_end_catch_block): Update call.
|
||||
* parser.c (cp_parser_unary_expression): Update
|
||||
cxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls,
|
||||
pass the compound location.
|
||||
(cp_parser_throw_expression): Likewise pass the combined location
|
||||
to build_throw.
|
||||
* cp-tree.h: Update declarations.
|
||||
|
||||
* semantics.c (finish_handler_parms): Use DECL_SOURCE_LOCATION.
|
||||
* decl2.c (check_classfn): Likewise.
|
||||
|
||||
* except.c (is_admissible_throw_operand_or_catch_parameter):
|
||||
Exploit cp_expr_loc_or_input_loc in one place.
|
||||
|
||||
* except.c (create_try_catch_expr): Remove, unused.
|
||||
|
||||
2019-12-17 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/12333 - X::~X() with implicit this->.
|
||||
|
@ -6657,7 +6657,7 @@ extern void init_exception_processing (void);
|
||||
extern tree expand_start_catch_block (tree);
|
||||
extern void expand_end_catch_block (void);
|
||||
extern tree build_exc_ptr (void);
|
||||
extern tree build_throw (tree);
|
||||
extern tree build_throw (location_t, tree);
|
||||
extern int nothrow_libfn_p (const_tree);
|
||||
extern void check_handlers (tree);
|
||||
extern tree finish_noexcept_expr (tree, tsubst_flags_t);
|
||||
@ -6674,7 +6674,6 @@ extern tree begin_eh_spec_block (void);
|
||||
extern void finish_eh_spec_block (tree, tree);
|
||||
extern tree build_eh_type_type (tree);
|
||||
extern tree cp_protect_cleanup_actions (void);
|
||||
extern tree create_try_catch_expr (tree, tree);
|
||||
extern tree template_parms_to_args (tree);
|
||||
extern tree template_parms_level_to_args (tree);
|
||||
extern tree generic_targs_for (tree);
|
||||
@ -7487,8 +7486,10 @@ extern bool compparms (const_tree, const_tree);
|
||||
extern int comp_cv_qualification (const_tree, const_tree);
|
||||
extern int comp_cv_qualification (int, int);
|
||||
extern int comp_cv_qual_signature (tree, tree);
|
||||
extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool);
|
||||
extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool, bool);
|
||||
extern tree cxx_sizeof_or_alignof_expr (location_t, tree,
|
||||
enum tree_code, bool);
|
||||
extern tree cxx_sizeof_or_alignof_type (location_t, tree,
|
||||
enum tree_code, bool, bool);
|
||||
extern tree cxx_alignas_expr (tree);
|
||||
extern tree cxx_sizeof_nowarn (tree);
|
||||
extern tree is_bitfield_expr_with_lowered_type (const_tree);
|
||||
@ -7604,7 +7605,7 @@ extern tree cp_build_binary_op (const op_location_t &,
|
||||
extern tree build_x_vec_perm_expr (location_t,
|
||||
tree, tree, tree,
|
||||
tsubst_flags_t);
|
||||
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false, true)
|
||||
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (input_location, T, SIZEOF_EXPR, false, true)
|
||||
extern tree build_simple_component_ref (tree, tree);
|
||||
extern tree build_ptrmemfunc_access_expr (tree, tree);
|
||||
extern tree build_address (tree);
|
||||
|
@ -10219,13 +10219,16 @@ fold_sizeof_expr (tree t)
|
||||
{
|
||||
tree r;
|
||||
if (SIZEOF_EXPR_TYPE_P (t))
|
||||
r = cxx_sizeof_or_alignof_type (TREE_TYPE (TREE_OPERAND (t, 0)),
|
||||
r = cxx_sizeof_or_alignof_type (EXPR_LOCATION (t),
|
||||
TREE_TYPE (TREE_OPERAND (t, 0)),
|
||||
SIZEOF_EXPR, false, false);
|
||||
else if (TYPE_P (TREE_OPERAND (t, 0)))
|
||||
r = cxx_sizeof_or_alignof_type (TREE_OPERAND (t, 0), SIZEOF_EXPR,
|
||||
r = cxx_sizeof_or_alignof_type (EXPR_LOCATION (t),
|
||||
TREE_OPERAND (t, 0), SIZEOF_EXPR,
|
||||
false, false);
|
||||
else
|
||||
r = cxx_sizeof_or_alignof_expr (TREE_OPERAND (t, 0), SIZEOF_EXPR,
|
||||
r = cxx_sizeof_or_alignof_expr (EXPR_LOCATION (t),
|
||||
TREE_OPERAND (t, 0), SIZEOF_EXPR,
|
||||
false);
|
||||
if (r == error_mark_node)
|
||||
r = size_one_node;
|
||||
|
@ -698,7 +698,8 @@ check_classfn (tree ctype, tree function, tree template_parms)
|
||||
if (!matched)
|
||||
{
|
||||
if (!COMPLETE_TYPE_P (ctype))
|
||||
cxx_incomplete_type_error (function, ctype);
|
||||
cxx_incomplete_type_error (DECL_SOURCE_LOCATION (function),
|
||||
function, ctype);
|
||||
else
|
||||
{
|
||||
if (DECL_CONV_FN_P (function))
|
||||
|
@ -507,7 +507,7 @@ expand_end_catch_block (void)
|
||||
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|
||||
|| DECL_DESTRUCTOR_P (current_function_decl)))
|
||||
{
|
||||
tree rethrow = build_throw (NULL_TREE);
|
||||
tree rethrow = build_throw (input_location, NULL_TREE);
|
||||
TREE_NO_WARNING (rethrow) = true;
|
||||
finish_expr_stmt (rethrow);
|
||||
}
|
||||
@ -627,7 +627,7 @@ wrap_cleanups_r (tree *tp, int *walk_subtrees, void * /*data*/)
|
||||
/* Build a throw expression. */
|
||||
|
||||
tree
|
||||
build_throw (tree exp)
|
||||
build_throw (location_t loc, tree exp)
|
||||
{
|
||||
if (exp == error_mark_node)
|
||||
return exp;
|
||||
@ -637,12 +637,13 @@ build_throw (tree exp)
|
||||
if (cfun)
|
||||
current_function_returns_abnormally = 1;
|
||||
exp = build_min (THROW_EXPR, void_type_node, exp);
|
||||
SET_EXPR_LOCATION (exp, input_location);
|
||||
SET_EXPR_LOCATION (exp, loc);
|
||||
return exp;
|
||||
}
|
||||
|
||||
if (exp && null_node_p (exp))
|
||||
warning (0, "throwing NULL, which has integral, not pointer type");
|
||||
warning_at (loc, 0,
|
||||
"throwing NULL, which has integral, not pointer type");
|
||||
|
||||
if (exp != NULL_TREE)
|
||||
{
|
||||
@ -758,6 +759,7 @@ build_throw (tree exp)
|
||||
{
|
||||
int flags = LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING;
|
||||
bool converted = false;
|
||||
location_t exp_loc = cp_expr_loc_or_loc (exp, loc);
|
||||
|
||||
/* Under C++0x [12.8/16 class.copy], a thrown lvalue is sometimes
|
||||
treated as an rvalue for the purposes of overload resolution
|
||||
@ -790,7 +792,7 @@ build_throw (tree exp)
|
||||
|
||||
if (exp == error_mark_node)
|
||||
{
|
||||
error (" in thrown expression");
|
||||
inform (exp_loc, " in thrown expression");
|
||||
return error_mark_node;
|
||||
}
|
||||
}
|
||||
@ -867,8 +869,7 @@ build_throw (tree exp)
|
||||
exp = cp_build_function_call_vec (rethrow_fn, NULL, tf_warning_or_error);
|
||||
}
|
||||
|
||||
exp = build1 (THROW_EXPR, void_type_node, exp);
|
||||
SET_EXPR_LOCATION (exp, input_location);
|
||||
exp = build1_loc (loc, THROW_EXPR, void_type_node, exp);
|
||||
|
||||
return exp;
|
||||
}
|
||||
@ -948,8 +949,9 @@ is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw)
|
||||
else if (variably_modified_type_p (type, NULL_TREE))
|
||||
{
|
||||
if (is_throw)
|
||||
error ("cannot throw expression of type %qT because it involves "
|
||||
"types of variable size", type);
|
||||
error_at (cp_expr_loc_or_input_loc (expr),
|
||||
"cannot throw expression of type %qT because it involves "
|
||||
"types of variable size", type);
|
||||
else
|
||||
error ("cannot catch type %qT because it involves types of "
|
||||
"variable size", type);
|
||||
@ -1321,22 +1323,4 @@ build_noexcept_spec (tree expr, tsubst_flags_t complain)
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns a TRY_CATCH_EXPR that will put TRY_LIST and CATCH_LIST in the
|
||||
TRY and CATCH locations. CATCH_LIST must be a STATEMENT_LIST */
|
||||
|
||||
tree
|
||||
create_try_catch_expr (tree try_expr, tree catch_list)
|
||||
{
|
||||
location_t loc = EXPR_LOCATION (try_expr);
|
||||
|
||||
append_to_statement_list (do_begin_catch (), &catch_list);
|
||||
append_to_statement_list (build_throw (NULL_TREE), &catch_list);
|
||||
tree catch_tf_expr = build_stmt (loc, TRY_FINALLY_EXPR, catch_list,
|
||||
do_end_catch (NULL_TREE));
|
||||
catch_list = build2 (CATCH_EXPR, void_type_node, NULL_TREE,
|
||||
catch_tf_expr);
|
||||
tree try_catch_expr = build_stmt (loc, TRY_CATCH_EXPR, try_expr, catch_list);
|
||||
return try_catch_expr;
|
||||
}
|
||||
|
||||
#include "gt-cp-except.h"
|
||||
|
@ -8170,9 +8170,17 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk,
|
||||
/* Parse the operand. */
|
||||
operand = cp_parser_sizeof_operand (parser, keyword);
|
||||
|
||||
/* Construct a location e.g. :
|
||||
alignof (expr)
|
||||
^~~~~~~~~~~~~~
|
||||
with start == caret at the start of the "alignof"/"sizeof"
|
||||
token, with the endpoint at the final closing paren. */
|
||||
location_t compound_loc
|
||||
= make_location (start_loc, start_loc, parser->lexer);
|
||||
|
||||
if (TYPE_P (operand))
|
||||
ret = cxx_sizeof_or_alignof_type (operand, op, std_alignof,
|
||||
true);
|
||||
ret = cxx_sizeof_or_alignof_type (compound_loc, operand, op,
|
||||
std_alignof, true);
|
||||
else
|
||||
{
|
||||
/* ISO C++ defines alignof only with types, not with
|
||||
@ -8183,7 +8191,8 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk,
|
||||
"ISO C++ does not allow %<alignof%> "
|
||||
"with a non-type");
|
||||
|
||||
ret = cxx_sizeof_or_alignof_expr (operand, op, true);
|
||||
ret = cxx_sizeof_or_alignof_expr (compound_loc,
|
||||
operand, op, true);
|
||||
}
|
||||
/* For SIZEOF_EXPR, just issue diagnostics, but keep
|
||||
SIZEOF_EXPR with the original operand. */
|
||||
@ -8202,19 +8211,11 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk,
|
||||
ret = build_min (SIZEOF_EXPR, size_type_node, operand);
|
||||
TREE_SIDE_EFFECTS (ret) = 0;
|
||||
TREE_READONLY (ret) = 1;
|
||||
SET_EXPR_LOCATION (ret, compound_loc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Construct a location e.g. :
|
||||
alignof (expr)
|
||||
^~~~~~~~~~~~~~
|
||||
with start == caret at the start of the "alignof"/"sizeof"
|
||||
token, with the endpoint at the final closing paren. */
|
||||
location_t compound_loc
|
||||
= make_location (start_loc, start_loc, parser->lexer);
|
||||
|
||||
cp_expr ret_expr (ret);
|
||||
ret_expr.set_location (compound_loc);
|
||||
cp_expr ret_expr (ret, compound_loc);
|
||||
ret_expr = ret_expr.maybe_add_location_wrapper ();
|
||||
return ret_expr;
|
||||
}
|
||||
@ -26066,8 +26067,7 @@ cp_parser_throw_expression (cp_parser* parser)
|
||||
the end at the end of the final token we consumed. */
|
||||
location_t combined_loc = make_location (start_loc, start_loc,
|
||||
parser->lexer);
|
||||
expression = build_throw (expression);
|
||||
protected_set_expr_location (expression, combined_loc);
|
||||
expression = build_throw (combined_loc, expression);
|
||||
|
||||
return expression;
|
||||
}
|
||||
|
14
gcc/cp/pt.c
14
gcc/cp/pt.c
@ -16400,11 +16400,13 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
||||
expanded = make_argument_pack (expanded);
|
||||
|
||||
if (TYPE_P (expanded))
|
||||
return cxx_sizeof_or_alignof_type (expanded, SIZEOF_EXPR,
|
||||
return cxx_sizeof_or_alignof_type (input_location,
|
||||
expanded, SIZEOF_EXPR,
|
||||
false,
|
||||
complain & tf_error);
|
||||
else
|
||||
return cxx_sizeof_or_alignof_expr (expanded, SIZEOF_EXPR,
|
||||
return cxx_sizeof_or_alignof_expr (input_location,
|
||||
expanded, SIZEOF_EXPR,
|
||||
complain & tf_error);
|
||||
}
|
||||
else
|
||||
@ -19194,10 +19196,12 @@ tsubst_copy_and_build (tree t,
|
||||
--c_inhibit_evaluation_warnings;
|
||||
}
|
||||
if (TYPE_P (op1))
|
||||
r = cxx_sizeof_or_alignof_type (op1, TREE_CODE (t), std_alignof,
|
||||
r = cxx_sizeof_or_alignof_type (input_location,
|
||||
op1, TREE_CODE (t), std_alignof,
|
||||
complain & tf_error);
|
||||
else
|
||||
r = cxx_sizeof_or_alignof_expr (op1, TREE_CODE (t),
|
||||
r = cxx_sizeof_or_alignof_expr (input_location,
|
||||
op1, TREE_CODE (t),
|
||||
complain & tf_error);
|
||||
if (TREE_CODE (t) == SIZEOF_EXPR && r != error_mark_node)
|
||||
{
|
||||
@ -19959,7 +19963,7 @@ tsubst_copy_and_build (tree t,
|
||||
|
||||
case THROW_EXPR:
|
||||
RETURN (build_throw
|
||||
(RECUR (TREE_OPERAND (t, 0))));
|
||||
(input_location, RECUR (TREE_OPERAND (t, 0))));
|
||||
|
||||
case CONSTRUCTOR:
|
||||
{
|
||||
|
@ -1429,15 +1429,19 @@ finish_handler_parms (tree decl, tree handler)
|
||||
if (CLASS_TYPE_P (orig_type))
|
||||
{
|
||||
if (TYPE_POLYMORPHIC_P (orig_type))
|
||||
warning (OPT_Wcatch_value_,
|
||||
"catching polymorphic type %q#T by value", orig_type);
|
||||
warning_at (DECL_SOURCE_LOCATION (decl),
|
||||
OPT_Wcatch_value_,
|
||||
"catching polymorphic type %q#T by value",
|
||||
orig_type);
|
||||
else if (warn_catch_value > 1)
|
||||
warning (OPT_Wcatch_value_,
|
||||
"catching type %q#T by value", orig_type);
|
||||
warning_at (DECL_SOURCE_LOCATION (decl),
|
||||
OPT_Wcatch_value_,
|
||||
"catching type %q#T by value", orig_type);
|
||||
}
|
||||
else if (warn_catch_value > 2)
|
||||
warning (OPT_Wcatch_value_,
|
||||
"catching non-reference type %q#T", orig_type);
|
||||
warning_at (DECL_SOURCE_LOCATION (decl),
|
||||
OPT_Wcatch_value_,
|
||||
"catching non-reference type %q#T", orig_type);
|
||||
}
|
||||
}
|
||||
HANDLER_TYPE (handler) = type;
|
||||
|
@ -1662,8 +1662,8 @@ compparms (const_tree parms1, const_tree parms2)
|
||||
SIZEOF_EXPR. */
|
||||
|
||||
tree
|
||||
cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool std_alignof,
|
||||
bool complain)
|
||||
cxx_sizeof_or_alignof_type (location_t loc, tree type, enum tree_code op,
|
||||
bool std_alignof, bool complain)
|
||||
{
|
||||
gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR);
|
||||
if (type == error_mark_node)
|
||||
@ -1674,7 +1674,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool std_alignof,
|
||||
{
|
||||
if (complain)
|
||||
{
|
||||
pedwarn (input_location, OPT_Wpointer_arith,
|
||||
pedwarn (loc, OPT_Wpointer_arith,
|
||||
"invalid application of %qs to a member function",
|
||||
OVL_OP_INFO (false, op)->name);
|
||||
return size_one_node;
|
||||
@ -1701,10 +1701,11 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool std_alignof,
|
||||
TREE_READONLY (value) = 1;
|
||||
if (op == ALIGNOF_EXPR && std_alignof)
|
||||
ALIGNOF_EXPR_STD_P (value) = true;
|
||||
SET_EXPR_LOCATION (value, loc);
|
||||
return value;
|
||||
}
|
||||
|
||||
return c_sizeof_or_alignof_type (input_location, complete_type (type),
|
||||
return c_sizeof_or_alignof_type (loc, complete_type (type),
|
||||
op == SIZEOF_EXPR, std_alignof,
|
||||
complain);
|
||||
}
|
||||
@ -1723,13 +1724,14 @@ cxx_sizeof_nowarn (tree type)
|
||||
else if (!COMPLETE_TYPE_P (type))
|
||||
return size_zero_node;
|
||||
else
|
||||
return cxx_sizeof_or_alignof_type (type, SIZEOF_EXPR, false, false);
|
||||
return cxx_sizeof_or_alignof_type (input_location, type,
|
||||
SIZEOF_EXPR, false, false);
|
||||
}
|
||||
|
||||
/* Process a sizeof expression where the operand is an expression. */
|
||||
|
||||
static tree
|
||||
cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
cxx_sizeof_expr (location_t loc, tree e, tsubst_flags_t complain)
|
||||
{
|
||||
if (e == error_mark_node)
|
||||
return error_mark_node;
|
||||
@ -1739,10 +1741,12 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
e = build_min (SIZEOF_EXPR, size_type_node, e);
|
||||
TREE_SIDE_EFFECTS (e) = 0;
|
||||
TREE_READONLY (e) = 1;
|
||||
SET_EXPR_LOCATION (e, loc);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
location_t e_loc = cp_expr_loc_or_loc (e, loc);
|
||||
STRIP_ANY_LOCATION_WRAPPER (e);
|
||||
|
||||
/* To get the size of a static data member declared as an array of
|
||||
@ -1757,8 +1761,9 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
&& (complain & tf_warning))
|
||||
{
|
||||
auto_diagnostic_group d;
|
||||
if (warning (OPT_Wsizeof_array_argument, "%<sizeof%> on array function "
|
||||
"parameter %qE will return size of %qT", e, TREE_TYPE (e)))
|
||||
if (warning_at (e_loc, OPT_Wsizeof_array_argument,
|
||||
"%<sizeof%> on array function parameter %qE "
|
||||
"will return size of %qT", e, TREE_TYPE (e)))
|
||||
inform (DECL_SOURCE_LOCATION (e), "declared here");
|
||||
}
|
||||
|
||||
@ -1767,7 +1772,7 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
if (bitfield_p (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error_at (cp_expr_loc_or_input_loc (e),
|
||||
error_at (e_loc,
|
||||
"invalid application of %<sizeof%> to a bit-field");
|
||||
else
|
||||
return error_mark_node;
|
||||
@ -1776,9 +1781,8 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
else if (is_overloaded_fn (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
permerror (cp_expr_loc_or_input_loc (e),
|
||||
"ISO C++ forbids applying %<sizeof%> to an expression "
|
||||
"of function type");
|
||||
permerror (e_loc, "ISO C++ forbids applying %<sizeof%> to "
|
||||
"an expression of function type");
|
||||
else
|
||||
return error_mark_node;
|
||||
e = char_type_node;
|
||||
@ -1786,7 +1790,7 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
else if (type_unknown_p (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
cxx_incomplete_type_error (e, TREE_TYPE (e));
|
||||
cxx_incomplete_type_error (e_loc, e, TREE_TYPE (e));
|
||||
else
|
||||
return error_mark_node;
|
||||
e = char_type_node;
|
||||
@ -1794,7 +1798,8 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
else
|
||||
e = TREE_TYPE (e);
|
||||
|
||||
return cxx_sizeof_or_alignof_type (e, SIZEOF_EXPR, false, complain & tf_error);
|
||||
return cxx_sizeof_or_alignof_type (loc, e, SIZEOF_EXPR, false,
|
||||
complain & tf_error);
|
||||
}
|
||||
|
||||
/* Implement the __alignof keyword: Return the minimum required
|
||||
@ -1803,7 +1808,7 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
|
||||
"aligned" __attribute__ specification). */
|
||||
|
||||
static tree
|
||||
cxx_alignof_expr (tree e, tsubst_flags_t complain)
|
||||
cxx_alignof_expr (location_t loc, tree e, tsubst_flags_t complain)
|
||||
{
|
||||
tree t;
|
||||
|
||||
@ -1815,15 +1820,17 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain)
|
||||
e = build_min (ALIGNOF_EXPR, size_type_node, e);
|
||||
TREE_SIDE_EFFECTS (e) = 0;
|
||||
TREE_READONLY (e) = 1;
|
||||
SET_EXPR_LOCATION (e, loc);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
location_t e_loc = cp_expr_loc_or_loc (e, loc);
|
||||
STRIP_ANY_LOCATION_WRAPPER (e);
|
||||
|
||||
e = mark_type_use (e);
|
||||
|
||||
if (!verify_type_context (input_location, TCTX_ALIGNOF, TREE_TYPE (e),
|
||||
if (!verify_type_context (loc, TCTX_ALIGNOF, TREE_TYPE (e),
|
||||
!(complain & tf_error)))
|
||||
{
|
||||
if (!(complain & tf_error))
|
||||
@ -1835,7 +1842,7 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain)
|
||||
else if (bitfield_p (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error_at (cp_expr_loc_or_input_loc (e),
|
||||
error_at (e_loc,
|
||||
"invalid application of %<__alignof%> to a bit-field");
|
||||
else
|
||||
return error_mark_node;
|
||||
@ -1847,9 +1854,8 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain)
|
||||
else if (is_overloaded_fn (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
permerror (cp_expr_loc_or_input_loc (e),
|
||||
"ISO C++ forbids applying %<__alignof%> to an expression "
|
||||
"of function type");
|
||||
permerror (e_loc, "ISO C++ forbids applying %<__alignof%> to "
|
||||
"an expression of function type");
|
||||
else
|
||||
return error_mark_node;
|
||||
if (TREE_CODE (e) == FUNCTION_DECL)
|
||||
@ -1860,28 +1866,30 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain)
|
||||
else if (type_unknown_p (e))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
cxx_incomplete_type_error (e, TREE_TYPE (e));
|
||||
cxx_incomplete_type_error (e_loc, e, TREE_TYPE (e));
|
||||
else
|
||||
return error_mark_node;
|
||||
t = size_one_node;
|
||||
}
|
||||
else
|
||||
return cxx_sizeof_or_alignof_type (TREE_TYPE (e), ALIGNOF_EXPR, false,
|
||||
return cxx_sizeof_or_alignof_type (loc, TREE_TYPE (e),
|
||||
ALIGNOF_EXPR, false,
|
||||
complain & tf_error);
|
||||
|
||||
return fold_convert (size_type_node, t);
|
||||
return fold_convert_loc (loc, size_type_node, t);
|
||||
}
|
||||
|
||||
/* Process a sizeof or alignof expression E with code OP where the operand
|
||||
is an expression. */
|
||||
|
||||
tree
|
||||
cxx_sizeof_or_alignof_expr (tree e, enum tree_code op, bool complain)
|
||||
cxx_sizeof_or_alignof_expr (location_t loc, tree e, enum tree_code op,
|
||||
bool complain)
|
||||
{
|
||||
if (op == SIZEOF_EXPR)
|
||||
return cxx_sizeof_expr (e, complain? tf_warning_or_error : tf_none);
|
||||
return cxx_sizeof_expr (loc, e, complain? tf_warning_or_error : tf_none);
|
||||
else
|
||||
return cxx_alignof_expr (e, complain? tf_warning_or_error : tf_none);
|
||||
return cxx_alignof_expr (loc, e, complain? tf_warning_or_error : tf_none);
|
||||
}
|
||||
|
||||
/* Build a representation of an expression 'alignas(E).' Return the
|
||||
@ -1905,7 +1913,8 @@ cxx_alignas_expr (tree e)
|
||||
alignas(type-id ), it shall have the same effect as
|
||||
alignas(alignof(type-id )). */
|
||||
|
||||
return cxx_sizeof_or_alignof_type (e, ALIGNOF_EXPR, true, false);
|
||||
return cxx_sizeof_or_alignof_type (input_location,
|
||||
e, ALIGNOF_EXPR, true, false);
|
||||
|
||||
/* If we reach this point, it means the alignas expression if of
|
||||
the form "alignas(assignment-expression)", so we should follow
|
||||
|
@ -1,3 +1,26 @@
|
||||
2019-12-18 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* g++.dg/diagnostic/alignof2.C: New.
|
||||
* g++.dg/diagnostic/alignof3.C: Likewise.
|
||||
* g++.dg/diagnostic/incomplete-type-1.C: Likewise.
|
||||
* g++.dg/warn/Wcatch-value-3b.C: Likewise.
|
||||
* g++.dg/cpp0x/alignof3.C: Check location(s) too.
|
||||
* g++.dg/cpp1z/decomp-bitfield1.C: Likewise.
|
||||
* g++.dg/cpp1z/has-unique-obj-representations2.C: Likewise.
|
||||
* g++.dg/expr/sizeof3.C: Likewise.
|
||||
* g++.dg/ext/flexary6.C: Likewise.
|
||||
* g++.dg/ext/vla4.C: Likewise.
|
||||
* g++.dg/template/sizeof11.C: Likewise.
|
||||
* g++.dg/warn/Wcatch-value-1.C: Likewise.
|
||||
* g++.dg/warn/Wcatch-value-2.C: Likewise.
|
||||
* g++.dg/warn/Wcatch-value-3.C: Likewise.
|
||||
* g++.old-deja/g++.brendan/sizeof1.C: Likewise.
|
||||
* g++.old-deja/g++.brendan/sizeof3.C: Likewise.
|
||||
* g++.old-deja/g++.brendan/sizeof4.C: Likewise.
|
||||
* g++.old-deja/g++.eh/ctor1.C: Likewise.
|
||||
* g++.old-deja/g++.jason/ambig1.C: Likewise.
|
||||
* g++.old-deja/g++.other/sizeof4.C: Likewise.
|
||||
|
||||
2019-12-18 Peter Bergner <bergner@linux.ibm.com>
|
||||
|
||||
PR bootstrap/92661
|
||||
|
@ -2,5 +2,5 @@
|
||||
// { dg-options "-pedantic" }
|
||||
int main(void)
|
||||
{
|
||||
alignof(void (void)); // { dg-warning "function type" }
|
||||
alignof(void (void)); // { dg-warning "3:ISO C\\+\\+ does not permit .alignof. applied to a function type" }
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ void f()
|
||||
|
||||
long &r = x; // { dg-error "bit" }
|
||||
&x; // { dg-error "bit" }
|
||||
sizeof(x); // { dg-error "bit" }
|
||||
sizeof(x); // { dg-error "10:invalid application of .sizeof. to a bit-field" }
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
struct S;
|
||||
struct T { S t; }; // { dg-error "incomplete type" }
|
||||
struct U { int u[sizeof (S)]; }; // { dg-error "incomplete type" }
|
||||
struct T { S t; }; // { dg-error "14:field .t. has incomplete type" }
|
||||
struct U { int u[sizeof (S)]; }; // { dg-error "18:invalid application of .sizeof. to incomplete type" }
|
||||
union V { char c; char d[]; }; // { dg-error "24:flexible array member in union" }
|
||||
bool a = __has_unique_object_representations (S); // { dg-error "incomplete type" }
|
||||
bool b = __has_unique_object_representations (T);
|
||||
|
2
gcc/testsuite/g++.dg/diagnostic/alignof2.C
Normal file
2
gcc/testsuite/g++.dg/diagnostic/alignof2.C
Normal file
@ -0,0 +1,2 @@
|
||||
void f();
|
||||
int i = __alignof(f); // { dg-error "19:ISO C\\+\\+ forbids applying .__alignof." }
|
5
gcc/testsuite/g++.dg/diagnostic/alignof3.C
Normal file
5
gcc/testsuite/g++.dg/diagnostic/alignof3.C
Normal file
@ -0,0 +1,5 @@
|
||||
struct A { long i: 2; };
|
||||
void f()
|
||||
{
|
||||
__alignof(A::i); // { dg-error "16:invalid application of .__alignof. to a bit-field" }
|
||||
}
|
2
gcc/testsuite/g++.dg/diagnostic/incomplete-type-1.C
Normal file
2
gcc/testsuite/g++.dg/diagnostic/incomplete-type-1.C
Normal file
@ -0,0 +1,2 @@
|
||||
template<typename> struct A; // { dg-message "27:declaration" }
|
||||
template<typename T> A<T>::A(); // { dg-error "22:invalid use of incomplete type" }
|
@ -1,4 +1,4 @@
|
||||
// PR c++/15337
|
||||
|
||||
class CCC;
|
||||
int main() { sizeof(CCC); return 0; } // { dg-error ".*CCC.*" }
|
||||
int main() { sizeof(CCC); return 0; } // { dg-error "14:invalid application of .sizeof. to incomplete type .CCC." }
|
||||
|
@ -9,7 +9,7 @@ struct A {
|
||||
int n;
|
||||
int a[];
|
||||
enum {
|
||||
e = sizeof a // { dg-error "invalid application of .sizeof. to incomplete type" }
|
||||
e = sizeof a // { dg-error "9:invalid application of .sizeof. to incomplete type" }
|
||||
};
|
||||
};
|
||||
|
||||
@ -18,6 +18,6 @@ struct B {
|
||||
typedef int A[];
|
||||
A a;
|
||||
enum {
|
||||
e = sizeof a // { dg-error "invalid application of .sizeof. to incomplete type" }
|
||||
e = sizeof a // { dg-error "9:invalid application of .sizeof. to incomplete type" }
|
||||
};
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
void f(int i) {
|
||||
try {
|
||||
int a[i];
|
||||
throw &a; // { dg-error "int \\(\\*\\)\\\[i\\\]" }
|
||||
throw &a; // { dg-error "11:cannot throw expression of type .int \\(\\*\\)\\\[i\\\]." }
|
||||
} catch (int (*)[i]) { // { dg-error "variable size" }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ template < int> void g()
|
||||
template < class T > struct B;
|
||||
template < int> void f()
|
||||
{
|
||||
sizeof (B<int>); // { dg-error "incomplete" }
|
||||
sizeof (B<int>); // { dg-error "3:invalid application of .sizeof. to incomplete type" }
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ void foo()
|
||||
try {}
|
||||
catch (D) {}
|
||||
catch (C) {}
|
||||
catch (B) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (B) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A*) {}
|
||||
catch (int) {}
|
||||
|
||||
@ -27,7 +27,7 @@ void foo()
|
||||
template<typename T> void foo1()
|
||||
{
|
||||
try {}
|
||||
catch (T) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (T) {} // { dg-warning "10:catching polymorphic type" }
|
||||
}
|
||||
|
||||
template<typename T> void foo2()
|
||||
|
@ -8,10 +8,10 @@ struct D : C {};
|
||||
void foo()
|
||||
{
|
||||
try {}
|
||||
catch (D) {} // { dg-warning "catching type" }
|
||||
catch (C) {} // { dg-warning "catching type" }
|
||||
catch (B) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (D) {} // { dg-warning "10:catching type" }
|
||||
catch (C) {} // { dg-warning "10:catching type" }
|
||||
catch (B) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A*) {}
|
||||
catch (int) {}
|
||||
|
||||
@ -27,7 +27,7 @@ void foo()
|
||||
template<typename T> void foo1()
|
||||
{
|
||||
try {}
|
||||
catch (T) {} // { dg-warning "catching" }
|
||||
catch (T) {} // { dg-warning "10:catching" }
|
||||
}
|
||||
|
||||
template<typename T> void foo2()
|
||||
|
@ -8,12 +8,12 @@ struct D : C {};
|
||||
void foo()
|
||||
{
|
||||
try {}
|
||||
catch (D) {} // { dg-warning "catching type" }
|
||||
catch (C) {} // { dg-warning "catching type" }
|
||||
catch (B) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "catching polymorphic type" }
|
||||
catch (D) {} // { dg-warning "10:catching type" }
|
||||
catch (C) {} // { dg-warning "10:catching type" }
|
||||
catch (B) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A) {} // { dg-warning "10:catching polymorphic type" }
|
||||
catch (A*) {} // { dg-warning "catching non-reference type" }
|
||||
catch (int) {} // { dg-warning "catching non-reference type" }
|
||||
catch (int) {} // { dg-warning "10:catching non-reference type" }
|
||||
|
||||
try {}
|
||||
catch (D&) {}
|
||||
@ -27,7 +27,7 @@ void foo()
|
||||
template<typename T> void foo1()
|
||||
{
|
||||
try {}
|
||||
catch (T) {} // { dg-warning "catching" }
|
||||
catch (T) {} // { dg-warning "10:catching" }
|
||||
}
|
||||
|
||||
template<typename T> void foo2()
|
||||
|
64
gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
Normal file
64
gcc/testsuite/g++.dg/warn/Wcatch-value-3b.C
Normal file
@ -0,0 +1,64 @@
|
||||
// { dg-options "-Wcatch-value=3" }
|
||||
|
||||
struct A { virtual ~A() {} };
|
||||
struct B : A {};
|
||||
struct C {};
|
||||
struct D : C {};
|
||||
|
||||
void foo()
|
||||
{
|
||||
try {}
|
||||
catch (D d) {} // { dg-warning "12:catching type" }
|
||||
catch (C c) {} // { dg-warning "12:catching type" }
|
||||
catch (B b) {} // { dg-warning "12:catching polymorphic type" }
|
||||
catch (A a) {} // { dg-warning "12:catching polymorphic type" }
|
||||
catch (A* a) {} // { dg-warning "13:catching non-reference type" }
|
||||
catch (int i) {} // { dg-warning "14:catching non-reference type" }
|
||||
|
||||
try {}
|
||||
catch (D& d) {}
|
||||
catch (C& c) {}
|
||||
catch (B& b) {}
|
||||
catch (A& a) {}
|
||||
catch (A* a) {} // { dg-warning "13:catching non-reference type" }
|
||||
catch (int& i) {}
|
||||
}
|
||||
|
||||
template<typename T> void foo1()
|
||||
{
|
||||
try {}
|
||||
catch (T t) {} // { dg-warning "12:catching" }
|
||||
}
|
||||
|
||||
template<typename T> void foo2()
|
||||
{
|
||||
try {}
|
||||
catch (T* t) {} // { dg-warning "13:catching non-reference type" }
|
||||
|
||||
try {}
|
||||
catch (T&) {}
|
||||
|
||||
try {}
|
||||
catch (const T&) {}
|
||||
}
|
||||
|
||||
void bar()
|
||||
{
|
||||
foo1<int&>();
|
||||
foo1<const A&>();
|
||||
foo1<B&>();
|
||||
foo1<const C&>();
|
||||
foo1<D&>();
|
||||
|
||||
foo1<int>(); // { dg-message "required" }
|
||||
foo1<A>(); // { dg-message "required" }
|
||||
foo1<B>(); // { dg-message "required" }
|
||||
foo1<C>(); // { dg-message "required" }
|
||||
foo1<D>(); // { dg-message "required" }
|
||||
|
||||
foo2<int>(); // { dg-message "required" }
|
||||
foo2<A>(); // { dg-message "required" }
|
||||
foo2<B>(); // { dg-message "required" }
|
||||
foo2<C>(); // { dg-message "required" }
|
||||
foo2<D>(); // { dg-message "required" }
|
||||
}
|
@ -9,7 +9,7 @@ int
|
||||
main()
|
||||
{
|
||||
// sizeof may not be applied to a function
|
||||
int i = sizeof( f);// { dg-error "" } .*
|
||||
int i = sizeof( f);// { dg-error "19:ISO C\\+\\+ forbids applying .sizeof." } .*
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ int
|
||||
main()
|
||||
{
|
||||
// sizeof may not be applied to an undefined class
|
||||
int k = sizeof (bar);// { dg-error "" } .*
|
||||
int k = sizeof (bar);// { dg-error "11:invalid application of .sizeof. to incomplete type" } .*
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ int
|
||||
main()
|
||||
{
|
||||
// sizeof may not be applied to the type void
|
||||
int l = sizeof (void);// { dg-error "" } .*
|
||||
int l = sizeof (void);// { dg-error "11:invalid application of .sizeof. to a void type" } .*
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ main ()
|
||||
try
|
||||
{
|
||||
throw A(); // { dg-error "rvalue" "" { target c++14_down } } can't copy
|
||||
// { dg-error "thrown expression" "expr" { target c++14_down } .-1 }
|
||||
// { dg-message "13:thrown expression" "expr" { target c++14_down } .-1 }
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
// Testcase for ambiguity between functional cast and abstract declarator.
|
||||
// This ambiguity accounts for 6 of the r/r conflicts.
|
||||
|
||||
int i = sizeof (int ()); // { dg-error "" } sizeof applied to fn type
|
||||
int i = sizeof (int ()); // { dg-error "9:invalid application of .sizeof. to a function type" } sizeof applied to fn type
|
||||
int j = sizeof (int () + 1);
|
||||
|
@ -17,21 +17,21 @@ void fn () {}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
sizeof (s); // { dg-error "" } incomplete
|
||||
sizeof (0, s); // { dg-error "" } incomplete
|
||||
sizeof (argc ? s : s); // { dg-error "" } incomplete
|
||||
sizeof (s); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (0, s); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (argc ? s : s); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
|
||||
sizeof (arys); // { dg-error "" } incomplete
|
||||
sizeof (0, arys); // { dg-error "" } incomplete
|
||||
sizeof (argc ? arys : arys); // { dg-error "" } incomplete
|
||||
sizeof (arys); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (0, arys); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (argc ? arys : arys); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
|
||||
sizeof (aryt); // { dg-error "" } incomplete
|
||||
sizeof (0, aryt); // { dg-error "" } incomplete
|
||||
sizeof (argc ? aryt : aryt); // { dg-error "" } incomplete
|
||||
sizeof (aryt); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (0, aryt); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
sizeof (argc ? aryt : aryt); // { dg-error "3:invalid application of .sizeof. to incomplete type" } incomplete
|
||||
|
||||
sizeof (fn); // { dg-error "" } cannot take size of function
|
||||
sizeof (0, fn); // { dg-error "" } cannot take size of function
|
||||
sizeof (argc ? fn : fn); // { dg-error "" } cannot take size of function
|
||||
sizeof (fn); // { dg-error "11:ISO C\\+\\+ forbids applying .sizeof." } cannot take size of function
|
||||
sizeof (0, fn); // { dg-error "3:invalid application of .sizeof. to a function type" } cannot take size of function
|
||||
sizeof (argc ? fn : fn); // { dg-error "3:invalid application of .sizeof. to a function type" } cannot take size of function
|
||||
|
||||
sizeof (&fn); // ok
|
||||
sizeof (0, &fn); // ok
|
||||
|
@ -1,3 +1,10 @@
|
||||
2019-12-18 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* libcp1plugin.cc (plugin_build_unary_expr): Update build_throw
|
||||
and cxx_sizeof_or_alignof_expr calls.
|
||||
(plugin_build_unary_type_expr): Likewise for
|
||||
cxx_sizeof_or_alignof_type.
|
||||
|
||||
2019-12-09 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* libcp1plugin.cc (plugin_build_cast_expr): Adjust build_cast
|
||||
|
@ -2797,7 +2797,7 @@ plugin_build_unary_expr (cc1_plugin::connection *self,
|
||||
break;
|
||||
|
||||
case THROW_EXPR:
|
||||
result = build_throw (op0);
|
||||
result = build_throw (input_location, op0);
|
||||
break;
|
||||
|
||||
case TYPEID_EXPR:
|
||||
@ -2806,7 +2806,8 @@ plugin_build_unary_expr (cc1_plugin::connection *self,
|
||||
|
||||
case SIZEOF_EXPR:
|
||||
case ALIGNOF_EXPR:
|
||||
result = cxx_sizeof_or_alignof_expr (op0, opcode, true);
|
||||
result = cxx_sizeof_or_alignof_expr (input_location,
|
||||
op0, opcode, true);
|
||||
break;
|
||||
|
||||
case DELETE_EXPR:
|
||||
@ -3048,7 +3049,8 @@ plugin_build_unary_type_expr (cc1_plugin::connection *self,
|
||||
|
||||
default:
|
||||
/* Use the C++11 alignof semantics. */
|
||||
result = cxx_sizeof_or_alignof_type (type, opcode, true, true);
|
||||
result = cxx_sizeof_or_alignof_type (input_location, type,
|
||||
opcode, true, true);
|
||||
}
|
||||
|
||||
if (template_dependent_p)
|
||||
|
Loading…
x
Reference in New Issue
Block a user