Commit 3554d8ff by Paolo Carlini Committed by Paolo Carlini

typeck.c (cp_build_indirect_ref_1): Add location_t parameter and use it in error messages.

/gcc
2019-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* typeck.c (cp_build_indirect_ref_1): Add location_t parameter
	and use it in error messages.
	(build_x_indirect_ref): Adjust call.
	(build_indirect_ref): Likewise.
	(cp_build_fold_indirect_ref): Likewise.
	(cp_build_array_ref): Likewise.
	* call.c (build_new_op_1): Likewise.
	* semantics.c (finish_omp_clauses): Likewise.
	(finish_omp_depobj): Likewise.
	* typeck2.c (build_x_arrow): Likewise.
	* cp-tree.h (cp_build_indirect_ref): Update declaration.

	* call.c (build_new_op_1): Use location argument in warning_at.

	* typeck.c (cp_build_modify_expr): Consistently use the
	location_t argument.

/libcc1
2019-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* libcp1plugin.cc (plugin_pragma_push_user_expression): Update
	cp_build_indirect_ref call.

/gcc/testsuite
2019-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/diagnostic/base-operand-non-pointer-1.C: New.
	* g++.dg/pr53055.C: Check location too.
	* g++.old-deja/g++.bugs/900213_02.C: Likewise.
	* g++.old-deja/g++.bugs/900215_02.C: Likewise.
	* g++.old-deja/g++.other/badarrow.C: Likewise.
	* g++.old-deja/g++.other/deref1.C: Likewise.

	* g++.dg/warn/Wenum-compare.C: Check location too.

	* g++.dg/cpp0x/initlist26.C: Check location too.
	* g++.dg/cpp0x/initlist28.C: Likewise.
	* g++.dg/cpp0x/initlist29.C: Likewise.
	* g++.dg/cpp0x/initlist33.C: Likewise.
	* g++.dg/expr/string-2.C: Likewise.
	* g++.dg/other/ptrmem5.C: Likewise.
	* g++.old-deja/g++.benjamin/14664-1.C: Likewise.
	* g++.old-deja/g++.benjamin/14664-2.C: Likewise.
	* g++.old-deja/g++.brendan/init12.C: Likewise.
	* g++.old-deja/g++.bugs/900324_04.C: Likewise.
	* g++.old-deja/g++.ext/array1.C: Likewise.
	* g++.old-deja/g++.jason/rfg17.C: Likewise.

From-SVN: r278685
parent 5b8d9367
2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
* typeck.c (cp_build_indirect_ref_1): Add location_t parameter
and use it in error messages.
(build_x_indirect_ref): Adjust call.
(build_indirect_ref): Likewise.
(cp_build_fold_indirect_ref): Likewise.
(cp_build_array_ref): Likewise.
* call.c (build_new_op_1): Likewise.
* semantics.c (finish_omp_clauses): Likewise.
(finish_omp_depobj): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* cp-tree.h (cp_build_indirect_ref): Update declaration.
* call.c (build_new_op_1): Use location argument in warning_at.
* typeck.c (cp_build_modify_expr): Consistently use the
location_t argument.
2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de> 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/92365 PR c++/92365
......
...@@ -6354,11 +6354,9 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags, ...@@ -6354,11 +6354,9 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
&& (TYPE_MAIN_VARIANT (arg1_type) && (TYPE_MAIN_VARIANT (arg1_type)
!= TYPE_MAIN_VARIANT (arg2_type)) != TYPE_MAIN_VARIANT (arg2_type))
&& (complain & tf_warning)) && (complain & tf_warning))
{ warning_at (loc, OPT_Wenum_compare,
warning (OPT_Wenum_compare,
"comparison between %q#T and %q#T", "comparison between %q#T and %q#T",
arg1_type, arg2_type); arg1_type, arg2_type);
}
break; break;
default: default:
break; break;
...@@ -6416,7 +6414,7 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags, ...@@ -6416,7 +6414,7 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
return cp_build_modify_expr (loc, arg1, code2, arg2, complain); return cp_build_modify_expr (loc, arg1, code2, arg2, complain);
case INDIRECT_REF: case INDIRECT_REF:
return cp_build_indirect_ref (arg1, RO_UNARY_STAR, complain); return cp_build_indirect_ref (loc, arg1, RO_UNARY_STAR, complain);
case TRUTH_ANDIF_EXPR: case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR: case TRUTH_ORIF_EXPR:
...@@ -6472,7 +6470,8 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags, ...@@ -6472,7 +6470,8 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
return cp_build_array_ref (input_location, arg1, arg2, complain); return cp_build_array_ref (input_location, arg1, arg2, complain);
case MEMBER_REF: case MEMBER_REF:
return build_m_component_ref (cp_build_indirect_ref (arg1, RO_ARROW_STAR, return build_m_component_ref (cp_build_indirect_ref (loc, arg1,
RO_ARROW_STAR,
complain), complain),
arg2, complain); arg2, complain);
......
...@@ -7482,8 +7482,10 @@ extern tree build_class_member_access_expr (cp_expr, tree, tree, bool, ...@@ -7482,8 +7482,10 @@ extern tree build_class_member_access_expr (cp_expr, tree, tree, bool,
extern tree finish_class_member_access_expr (cp_expr, tree, bool, extern tree finish_class_member_access_expr (cp_expr, tree, bool,
tsubst_flags_t); tsubst_flags_t);
extern tree build_x_indirect_ref (location_t, tree, extern tree build_x_indirect_ref (location_t, tree,
ref_operator, tsubst_flags_t); ref_operator,
extern tree cp_build_indirect_ref (tree, ref_operator, tsubst_flags_t);
extern tree cp_build_indirect_ref (location_t, tree,
ref_operator,
tsubst_flags_t); tsubst_flags_t);
extern tree cp_build_fold_indirect_ref (tree); extern tree cp_build_fold_indirect_ref (tree);
extern tree build_array_ref (location_t, tree, tree); extern tree build_array_ref (location_t, tree, tree);
......
...@@ -7193,7 +7193,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) ...@@ -7193,7 +7193,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
remove = true; remove = true;
else else
{ {
t = cp_build_indirect_ref (addr, RO_UNARY_STAR, t = cp_build_indirect_ref (OMP_CLAUSE_LOCATION (c),
addr, RO_UNARY_STAR,
tf_warning_or_error); tf_warning_or_error);
if (t == error_mark_node) if (t == error_mark_node)
remove = true; remove = true;
...@@ -9328,7 +9329,7 @@ finish_omp_depobj (location_t loc, tree depobj, ...@@ -9328,7 +9329,7 @@ finish_omp_depobj (location_t loc, tree depobj,
if (addr == error_mark_node) if (addr == error_mark_node)
depobj = error_mark_node; depobj = error_mark_node;
else else
depobj = cp_build_indirect_ref (addr, RO_UNARY_STAR, depobj = cp_build_indirect_ref (loc, addr, RO_UNARY_STAR,
tf_warning_or_error); tf_warning_or_error);
} }
......
...@@ -3278,7 +3278,7 @@ build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring, ...@@ -3278,7 +3278,7 @@ build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring,
rval = build_new_op (loc, INDIRECT_REF, LOOKUP_NORMAL, expr, rval = build_new_op (loc, INDIRECT_REF, LOOKUP_NORMAL, expr,
NULL_TREE, NULL_TREE, &overload, complain); NULL_TREE, NULL_TREE, &overload, complain);
if (!rval) if (!rval)
rval = cp_build_indirect_ref (expr, errorstring, complain); rval = cp_build_indirect_ref (loc, expr, errorstring, complain);
if (processing_template_decl && rval != error_mark_node) if (processing_template_decl && rval != error_mark_node)
{ {
...@@ -3296,7 +3296,7 @@ build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring, ...@@ -3296,7 +3296,7 @@ build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring,
constructs. If DO_FOLD is true, fold away INDIRECT_REF of ADDR_EXPR. */ constructs. If DO_FOLD is true, fold away INDIRECT_REF of ADDR_EXPR. */
static tree static tree
cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring, cp_build_indirect_ref_1 (location_t loc, tree ptr, ref_operator errorstring,
tsubst_flags_t complain, bool do_fold) tsubst_flags_t complain, bool do_fold)
{ {
tree pointer, type; tree pointer, type;
...@@ -3345,7 +3345,7 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring, ...@@ -3345,7 +3345,7 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring,
/* A pointer to incomplete type (other than cv void) can be /* A pointer to incomplete type (other than cv void) can be
dereferenced [expr.unary.op]/1 */ dereferenced [expr.unary.op]/1 */
if (complain & tf_error) if (complain & tf_error)
error ("%qT is not a pointer-to-object type", type); error_at (loc, "%qT is not a pointer-to-object type", type);
return error_mark_node; return error_mark_node;
} }
else if (do_fold && TREE_CODE (pointer) == ADDR_EXPR else if (do_fold && TREE_CODE (pointer) == ADDR_EXPR
...@@ -3376,23 +3376,25 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring, ...@@ -3376,23 +3376,25 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring,
switch (errorstring) switch (errorstring)
{ {
case RO_ARRAY_INDEXING: case RO_ARRAY_INDEXING:
error ("invalid use of array indexing on pointer to member"); error_at (loc,
"invalid use of array indexing on pointer to member");
break; break;
case RO_UNARY_STAR: case RO_UNARY_STAR:
error ("invalid use of unary %<*%> on pointer to member"); error_at (loc, "invalid use of unary %<*%> on pointer to member");
break; break;
case RO_IMPLICIT_CONVERSION: case RO_IMPLICIT_CONVERSION:
error ("invalid use of implicit conversion on pointer to member"); error_at (loc, "invalid use of implicit conversion on pointer "
"to member");
break; break;
case RO_ARROW_STAR: case RO_ARROW_STAR:
error ("left hand operand of %<->*%> must be a pointer to class, " error_at (loc, "left hand operand of %<->*%> must be a pointer to "
"but is a pointer to member of type %qT", type); "class, but is a pointer to member of type %qT", type);
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
else if (pointer != error_mark_node) else if (pointer != error_mark_node)
invalid_indirection_error (input_location, type, errorstring); invalid_indirection_error (loc, type, errorstring);
return error_mark_node; return error_mark_node;
} }
...@@ -3400,10 +3402,10 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring, ...@@ -3400,10 +3402,10 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring,
/* Entry point used by c-common, which expects folding. */ /* Entry point used by c-common, which expects folding. */
tree tree
build_indirect_ref (location_t /*loc*/, build_indirect_ref (location_t loc, tree ptr, ref_operator errorstring)
tree ptr, ref_operator errorstring)
{ {
return cp_build_indirect_ref_1 (ptr, errorstring, tf_warning_or_error, true); return cp_build_indirect_ref_1 (loc, ptr, errorstring,
tf_warning_or_error, true);
} }
/* Entry point used by internal indirection needs that don't correspond to any /* Entry point used by internal indirection needs that don't correspond to any
...@@ -3412,17 +3414,18 @@ build_indirect_ref (location_t /*loc*/, ...@@ -3412,17 +3414,18 @@ build_indirect_ref (location_t /*loc*/,
tree tree
cp_build_fold_indirect_ref (tree pointer) cp_build_fold_indirect_ref (tree pointer)
{ {
return cp_build_indirect_ref_1 (pointer, RO_NULL, tf_warning_or_error, true); return cp_build_indirect_ref_1 (input_location, pointer, RO_NULL,
tf_warning_or_error, true);
} }
/* Entry point used by indirection needs that correspond to some syntactic /* Entry point used by indirection needs that correspond to some syntactic
construct. */ construct. */
tree tree
cp_build_indirect_ref (tree ptr, ref_operator errorstring, cp_build_indirect_ref (location_t loc, tree ptr, ref_operator errorstring,
tsubst_flags_t complain) tsubst_flags_t complain)
{ {
return cp_build_indirect_ref_1 (ptr, errorstring, complain, false); return cp_build_indirect_ref_1 (loc, ptr, errorstring, complain, false);
} }
/* This handles expressions of the form "a[i]", which denotes /* This handles expressions of the form "a[i]", which denotes
...@@ -3599,7 +3602,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx, ...@@ -3599,7 +3602,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
ret = cp_build_binary_op (input_location, PLUS_EXPR, ar, ind, complain); ret = cp_build_binary_op (input_location, PLUS_EXPR, ar, ind, complain);
if (first) if (first)
ret = build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (ret), first, ret); ret = build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (ret), first, ret);
ret = cp_build_indirect_ref (ret, RO_ARRAY_INDEXING, complain); ret = cp_build_indirect_ref (loc, ret, RO_ARRAY_INDEXING, complain);
protected_set_expr_location (ret, loc); protected_set_expr_location (ret, loc);
if (non_lvalue) if (non_lvalue)
ret = non_lvalue_loc (loc, ret); ret = non_lvalue_loc (loc, ret);
...@@ -8280,7 +8283,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, ...@@ -8280,7 +8283,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
if (VOID_TYPE_P (TREE_TYPE (rhs))) if (VOID_TYPE_P (TREE_TYPE (rhs)))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("void value not ignored as it ought to be"); error_at (cp_expr_loc_or_loc (rhs, loc),
"void value not ignored as it ought to be");
return error_mark_node; return error_mark_node;
} }
...@@ -8493,7 +8497,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, ...@@ -8493,7 +8497,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
if (modifycode != INIT_EXPR) if (modifycode != INIT_EXPR)
{ {
if (complain & tf_error) if (complain & tf_error)
error ("assigning to an array from an initializer list"); error_at (loc,
"assigning to an array from an initializer list");
return error_mark_node; return error_mark_node;
} }
if (check_array_initializer (lhs, lhstype, newrhs)) if (check_array_initializer (lhs, lhstype, newrhs))
...@@ -8520,7 +8525,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, ...@@ -8520,7 +8525,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
TYPE_MAIN_VARIANT (TREE_TYPE (newrhs)))) TYPE_MAIN_VARIANT (TREE_TYPE (newrhs))))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("incompatible types in assignment of %qT to %qT", error_at (loc, "incompatible types in assignment of %qT to %qT",
TREE_TYPE (rhs), lhstype); TREE_TYPE (rhs), lhstype);
return error_mark_node; return error_mark_node;
} }
...@@ -8534,9 +8539,9 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, ...@@ -8534,9 +8539,9 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
if (complain & tf_error) if (complain & tf_error)
{ {
if (modifycode == INIT_EXPR) if (modifycode == INIT_EXPR)
error ("array used as initializer"); error_at (loc, "array used as initializer");
else else
error ("invalid array assignment"); error_at (loc, "invalid array assignment");
} }
return error_mark_node; return error_mark_node;
} }
......
...@@ -2060,7 +2060,7 @@ build_x_arrow (location_t loc, tree expr, tsubst_flags_t complain) ...@@ -2060,7 +2060,7 @@ build_x_arrow (location_t loc, tree expr, tsubst_flags_t complain)
return expr; return expr;
} }
return cp_build_indirect_ref (last_rval, RO_ARROW, complain); return cp_build_indirect_ref (loc, last_rval, RO_ARROW, complain);
} }
if (complain & tf_error) if (complain & tf_error)
......
2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/diagnostic/base-operand-non-pointer-1.C: New.
* g++.dg/pr53055.C: Check location too.
* g++.old-deja/g++.bugs/900213_02.C: Likewise.
* g++.old-deja/g++.bugs/900215_02.C: Likewise.
* g++.old-deja/g++.other/badarrow.C: Likewise.
* g++.old-deja/g++.other/deref1.C: Likewise.
* g++.dg/warn/Wenum-compare.C: Check location too.
* g++.dg/cpp0x/initlist26.C: Check location too.
* g++.dg/cpp0x/initlist28.C: Likewise.
* g++.dg/cpp0x/initlist29.C: Likewise.
* g++.dg/cpp0x/initlist33.C: Likewise.
* g++.dg/expr/string-2.C: Likewise.
* g++.dg/other/ptrmem5.C: Likewise.
* g++.old-deja/g++.benjamin/14664-1.C: Likewise.
* g++.old-deja/g++.benjamin/14664-2.C: Likewise.
* g++.old-deja/g++.brendan/init12.C: Likewise.
* g++.old-deja/g++.bugs/900324_04.C: Likewise.
* g++.old-deja/g++.ext/array1.C: Likewise.
* g++.old-deja/g++.jason/rfg17.C: Likewise.
2019-11-25 Joseph Myers <joseph@codesourcery.com> 2019-11-25 Joseph Myers <joseph@codesourcery.com>
PR c/91985 PR c/91985
......
...@@ -6,5 +6,5 @@ void ...@@ -6,5 +6,5 @@ void
foo (int i) foo (int i)
{ {
int a[i]; int a[i];
a = { }; // { dg-error "assign" } a = { }; // { dg-error "5:assigning to an array from an initializer list" }
} }
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
void foo() void foo()
{ {
int a[1]; int a[1];
throw a = {}; // { dg-error "assign" } throw a = {}; // { dg-error "11:assigning to an array from an initializer list" }
} }
...@@ -5,7 +5,7 @@ class Mesh ...@@ -5,7 +5,7 @@ class Mesh
{ {
public: public:
Mesh(const char*) Mesh(const char*)
{ typele={0}; } // { dg-error "" } { typele={0}; } // { dg-error "11:assigning to an array from an initializer list" }
private: private:
int typele[7][2]; int typele[7][2];
......
...@@ -9,5 +9,5 @@ struct base ...@@ -9,5 +9,5 @@ struct base
int main() int main()
{ {
base ptr_array[1]; base ptr_array[1];
ptr_array = { base() }; // { dg-error "assign" } ptr_array = { base() }; // { dg-error "12:assigning to an array from an initializer list" }
} }
class C { public: C f(); int get(); };
int f(C* p) { return p->f()->get(); } // { dg-error "28:base operand of .->. has non-pointer type .C." }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
char a[1]; char a[1];
int foo(a = "") // { dg-error "invalid array assignment" } int foo(a = "") // { dg-error "11:invalid array assignment" }
{ {
return 0; return 0;
} }
......
...@@ -8,5 +8,5 @@ struct a ...@@ -8,5 +8,5 @@ struct a
int main() int main()
{ {
int a::*n[8]; int a::*n[8];
n = &a::x; // { dg-error "int \\(a::\\*\\)" } n = &a::x; // { dg-error "5:incompatible types in assignment of .int \\(a::\\*\\)" }
} }
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
// { dg-do compile } // { dg-do compile }
struct A A :: * p ; struct A A :: * p ;
int i = p ->* p ; // { dg-error "" } int i = p ->* p ; // { dg-error "11:left hand operand" }
...@@ -6,5 +6,5 @@ enum E2 { b }; ...@@ -6,5 +6,5 @@ enum E2 { b };
int foo (E1 e1, E2 e2) int foo (E1 e1, E2 e2)
{ {
return e1 == e2; /* { dg-warning "comparison between" } */ return e1 == e2; /* { dg-warning "13:comparison between" } */
} }
...@@ -8,7 +8,7 @@ void bar() ...@@ -8,7 +8,7 @@ void bar()
{ {
//-g++: incompatible types in assignment of 'const char[]' to 'char[]' //-g++: incompatible types in assignment of 'const char[]' to 'char[]'
//-edg: expression must be a modifiable lvalue //-edg: expression must be a modifiable lvalue
foo = "0123456789012345678901234"; // { dg-error "" } // ERROR - foo = "0123456789012345678901234"; // { dg-error "7:invalid array assignment" } // ERROR -
} }
......
...@@ -7,7 +7,7 @@ char foo[26]; ...@@ -7,7 +7,7 @@ char foo[26];
void bar() void bar()
{ {
foo = "0123456789012345678901234"; // { dg-error "array" } foo = "0123456789012345678901234"; // { dg-error "7:invalid array assignment" }
} }
......
...@@ -5,5 +5,5 @@ char * bob(); ...@@ -5,5 +5,5 @@ char * bob();
int main() int main()
{ {
char a[1][2]; char a[1][2];
a[0] = bob();// { dg-error "" } .* a[0] = bob();// { dg-error "10:incompatible types in assignment" } .*
} }
...@@ -16,7 +16,7 @@ int struct0::*dmp; ...@@ -16,7 +16,7 @@ int struct0::*dmp;
void global_function_0 () void global_function_0 ()
{ {
i = *dmp; // { dg-error "invalid use of unary '\\\*' on pointer to member" } causes abort i = *dmp; // { dg-error "7:invalid use of unary '\\\*' on pointer to member" } causes abort
} }
int main () { return 0; } int main () { return 0; }
...@@ -41,8 +41,8 @@ void struct0::function_member () ...@@ -41,8 +41,8 @@ void struct0::function_member ()
i = (this->*fmp) (); // perfectly legal - for both cfront and g++ i = (this->*fmp) (); // perfectly legal - for both cfront and g++
i = this->*dmp; // perfectly legal - for both cfront and g++ i = this->*dmp; // perfectly legal - for both cfront and g++
i = (*fmp) (); // { dg-error "invalid use of unary '\\\*' on pointer to member" } i = (*fmp) (); // { dg-error "8:invalid use of unary '\\\*' on pointer to member" }
i = *dmp; // { dg-error "invalid use of unary '\\\*' on pointer to member" } i = *dmp; // { dg-error "7:invalid use of unary '\\\*' on pointer to member" }
} }
int main () { return 0; } int main () { return 0; }
...@@ -20,7 +20,7 @@ int_array ia2; ...@@ -20,7 +20,7 @@ int_array ia2;
void function_0 () void function_0 ()
{ {
ia1 = ia2; // { dg-error "" } gnu extension ia1 = ia2; // { dg-error "7:invalid array assignment" } gnu extension
} }
int main () { return 0; } int main () { return 0; }
...@@ -19,5 +19,5 @@ void ...@@ -19,5 +19,5 @@ void
ccBgaInspection::reinspect (unsigned long diag_flags) ccBgaInspection::reinspect (unsigned long diag_flags)
{ {
ct2d_rigid physTdev; ct2d_rigid physTdev;
_dev2phys = physTdev; // { dg-error "" } _dev2phys = physTdev; // { dg-error "13:incompatible types in assignment" }
} }
...@@ -12,5 +12,5 @@ void ...@@ -12,5 +12,5 @@ void
test () test ()
{ {
b1 = b2; /* OK */ b1 = b2; /* OK */
a1 = a2; /* { dg-error "" } array assignment */ a1 = a2; /* { dg-error "6:invalid array assignment" } array assignment */
} }
...@@ -6,5 +6,5 @@ struct S { ...@@ -6,5 +6,5 @@ struct S {
void f() void f()
{ {
s->i = 3; // { dg-error "" } base operand s->i = 3; // { dg-error "4:base operand of .->. has non-pointer type .S." } base operand
} }
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
void fn (void *vp, volatile void *vvp) void fn (void *vp, volatile void *vvp)
{ {
*vp; // { dg-error "" } not a pointer to object *vp; // { dg-error "3:.void\\*. is not a pointer-to-object type" } not a pointer to object
*vvp; // { dg-error "" } not a pointer to object *vvp; // { dg-error "3:.volatile void\\*. is not a pointer-to-object type" } not a pointer to object
&*vp; // { dg-error "" } not a pointer to object &*vp; // { dg-error "4:.void\\*. is not a pointer-to-object type" } not a pointer to object
&*vvp; // { dg-error "" } not a pointer to object &*vvp; // { dg-error "4:.volatile void\\*. is not a pointer-to-object type" } not a pointer to object
} }
2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
* libcp1plugin.cc (plugin_pragma_push_user_expression): Update
cp_build_indirect_ref call.
2019-09-27 Maciej W. Rozycki <macro@wdc.com> 2019-09-27 Maciej W. Rozycki <macro@wdc.com>
* configure: Regenerate. * configure: Regenerate.
......
...@@ -630,7 +630,8 @@ plugin_pragma_push_user_expression (cpp_reader *) ...@@ -630,7 +630,8 @@ plugin_pragma_push_user_expression (cpp_reader *)
usable. */ usable. */
tree this_val = lookup_name (get_identifier ("this")); tree this_val = lookup_name (get_identifier ("this"));
current_class_ref = !this_val ? NULL_TREE current_class_ref = !this_val ? NULL_TREE
: cp_build_indirect_ref (this_val, RO_NULL, tf_warning_or_error); : cp_build_indirect_ref (input_location, this_val, RO_NULL,
tf_warning_or_error);
current_class_ptr = this_val; current_class_ptr = this_val;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment