From: Paolo Carlini Date: Wed, 30 Oct 2019 11:49:21 +0000 (+0000) Subject: typeck.c (cp_build_modify_expr): Prefer error + inform to error + error in one place. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f92815326da137187fdf8841f48f6013a6022ed;p=gcc.git typeck.c (cp_build_modify_expr): Prefer error + inform to error + error in one place. /cp 2019-10-30 Paolo Carlini * typeck.c (cp_build_modify_expr): Prefer error + inform to error + error in one place. (get_delta_difference_1): Likewise. (get_delta_difference): Likewise, in two places. /testsuite 2019-10-30 Paolo Carlini * g++.dg/conversion/ptrmem2.C: Adjust for error + inform. * g++.dg/gomp/tpl-atomic-2.C: Likewise. From-SVN: r277610 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bc2b48eea75..87a78f20b60 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2019-10-30 Paolo Carlini + + * typeck.c (cp_build_modify_expr): Prefer error + inform to + error + error in one place. + (get_delta_difference_1): Likewise. + (get_delta_difference): Likewise, in two places. + 2019-10-29 Paolo Carlini * typeck.c (build_x_unary_op): Use the location_t argument in diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index ad46d42d215..477c6a39955 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8358,8 +8358,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, if (newrhs == error_mark_node) { if (complain & tf_error) - error (" in evaluation of %<%Q(%#T, %#T)%>", modifycode, - TREE_TYPE (lhs), TREE_TYPE (rhs)); + inform (loc, " in evaluation of %<%Q(%#T, %#T)%>", + modifycode, TREE_TYPE (lhs), TREE_TYPE (rhs)); return error_mark_node; } @@ -8594,7 +8594,7 @@ get_delta_difference_1 (tree from, tree to, bool c_cast_p, if (!(complain & tf_error)) return error_mark_node; - error (" in pointer to member function conversion"); + inform (input_location, " in pointer to member function conversion"); return size_zero_node; } else if (binfo) @@ -8655,7 +8655,7 @@ get_delta_difference (tree from, tree to, return error_mark_node; error_not_base_type (from, to); - error (" in pointer to member conversion"); + inform (input_location, " in pointer to member conversion"); result = size_zero_node; } else @@ -8674,7 +8674,7 @@ get_delta_difference (tree from, tree to, return error_mark_node; error_not_base_type (from, to); - error (" in pointer to member conversion"); + inform (input_location, " in pointer to member conversion"); result = size_zero_node; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65729622b8c..bac4d001550 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-30 Paolo Carlini + + * g++.dg/conversion/ptrmem2.C: Adjust for error + inform. + * g++.dg/gomp/tpl-atomic-2.C: Likewise. + 2019-10-30 Martin Liska PR lto/91393 diff --git a/gcc/testsuite/g++.dg/conversion/ptrmem2.C b/gcc/testsuite/g++.dg/conversion/ptrmem2.C index d46113db6c6..1dec36bfba8 100644 --- a/gcc/testsuite/g++.dg/conversion/ptrmem2.C +++ b/gcc/testsuite/g++.dg/conversion/ptrmem2.C @@ -15,16 +15,20 @@ int B::*p1 = static_cast(&D::x); int D::*p2 = static_cast(&B::x); // Virtual base class. -int V::*p3 = static_cast(&D::x); // { dg-error "" } -int D::*p4 = static_cast(&V::x); // { dg-error "" } +int V::*p3 = static_cast(&D::x); // { dg-error "virtual base" } +int D::*p4 = static_cast(&V::x); // { dg-error "virtual base" } // Inaccessible base class. -int P::*p5 = static_cast(&D::x); // { dg-error "" } -int D::*p6 = static_cast(&P::x); // { dg-error "" } +int P::*p5 = static_cast(&D::x); // { dg-error "inaccessible base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } +int D::*p6 = static_cast(&P::x); // { dg-error "inaccessible base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } // Ambiguous base class. -int A::*p7 = static_cast(&D::x); // { dg-error "" } -int D::*p8 = static_cast(&A::x); // { dg-error "" } +int A::*p7 = static_cast(&D::x); // { dg-error "ambiguous base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } +int D::*p8 = static_cast(&A::x); // { dg-error "ambiguous base" } +// { dg-message "pointer to member function" "" { target *-*-* } .-1 } // Valid conversions which increase cv-qualification. const int B::*p9 = static_cast(&D::x); @@ -35,5 +39,5 @@ int B::*p11 = static_cast(p10); // { dg-error "casts away qualifiers" int D::*p12 = static_cast(p9); // { dg-error "casts away qualifiers" } // Attempts to change member type. -float B::*p13 = static_cast(&D::x); // { dg-error "" } -float D::*p14 = static_cast(&B::x); // { dg-error "" } +float B::*p13 = static_cast(&D::x); // { dg-error "invalid .static_cast." } +float D::*p14 = static_cast(&B::x); // { dg-error "invalid .static_cast." } diff --git a/gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C b/gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C index 627c6c6e2a9..1591831c594 100644 --- a/gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C +++ b/gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C @@ -13,14 +13,14 @@ template void f1() template void f2(float *f) { #pragma omp atomic // { dg-error "invalid" } - *f |= 1; // { dg-error "evaluation" } + *f |= 1; // { dg-message "evaluation" "" { target *-*-* } .-1 } } // Here the rhs is dependent, but not type dependent. template void f3(float *f) { #pragma omp atomic // { dg-error "invalid" } - *f |= sizeof (T); // { dg-error "evaluation" } + *f |= sizeof (T); // { dg-message "evaluation" "" { target *-*-* } .-1 } } // And the converse, no error here because we're never fed a T.