Index: cp/typeck.c
===================================================================
--- cp/typeck.c	(revision 278692)
+++ cp/typeck.c	(working copy)
@@ -6520,7 +6520,8 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 	if (TREE_CODE (argtype) == ENUMERAL_TYPE)
           {
             if (complain & tf_error)
-              permerror (input_location, (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
+              permerror (location, (code == PREINCREMENT_EXPR
+				    || code == POSTINCREMENT_EXPR)
                          ? G_("ISO C++ forbids incrementing an enum")
                          : G_("ISO C++ forbids decrementing an enum"));
             else
@@ -6536,11 +6537,13 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 	    if (!COMPLETE_OR_VOID_TYPE_P (type))
               {
                 if (complain & tf_error)
-                  error (((code == PREINCREMENT_EXPR
-                           || code == POSTINCREMENT_EXPR))
-                         ? G_("cannot increment a pointer to incomplete type %qT")
-                         : G_("cannot decrement a pointer to incomplete type %qT"),
-                         TREE_TYPE (argtype));
+                  error_at (location, ((code == PREINCREMENT_EXPR
+					|| code == POSTINCREMENT_EXPR))
+			    ? G_("cannot increment a pointer to incomplete "
+				 "type %qT")
+			    : G_("cannot decrement a pointer to incomplete "
+				 "type %qT"),
+			    TREE_TYPE (argtype));
                 else
                   return error_mark_node;
               }
@@ -6547,11 +6550,13 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 	    else if (!TYPE_PTROB_P (argtype)) 
               {
                 if (complain & tf_error)
-                  pedwarn (input_location, OPT_Wpointer_arith,
+                  pedwarn (location, OPT_Wpointer_arith,
 			   (code == PREINCREMENT_EXPR
                               || code == POSTINCREMENT_EXPR)
-			   ? G_("ISO C++ forbids incrementing a pointer of type %qT")
-			   : G_("ISO C++ forbids decrementing a pointer of type %qT"),
+			   ? G_("ISO C++ forbids incrementing a pointer "
+				"of type %qT")
+			   : G_("ISO C++ forbids decrementing a pointer "
+				"of type %qT"),
 			   argtype);
                 else
                   return error_mark_node;
@@ -6597,8 +6602,9 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 	    if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
 	      {
                 if (complain & tf_error)
-		  error ("use of an operand of type %qT in %<operator--%> "
-			 "is forbidden", boolean_type_node);
+		  error_at (location,
+			    "use of an operand of type %qT in %<operator--%> "
+			    "is forbidden", boolean_type_node);
 		return error_mark_node;
 	      }
 	    else
@@ -6606,16 +6612,18 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 		if (cxx_dialect >= cxx17)
 		  {
 		    if (complain & tf_error)
-		      error ("use of an operand of type %qT in "
-			     "%<operator++%> is forbidden in C++17",
-			     boolean_type_node);
+		      error_at (location,
+				"use of an operand of type %qT in "
+				"%<operator++%> is forbidden in C++17",
+				boolean_type_node);
 		    return error_mark_node;
 		  }
 		/* Otherwise, [depr.incr.bool] says this is deprecated.  */
 		else
-		  warning (OPT_Wdeprecated, "use of an operand of type %qT "
-			   "in %<operator++%> is deprecated",
-			   boolean_type_node);
+		  warning_at (location, OPT_Wdeprecated,
+			      "use of an operand of type %qT "
+			      "in %<operator++%> is deprecated",
+			      boolean_type_node);
 	      }
 	    val = boolean_increment (code, arg);
 	  }
@@ -6646,7 +6654,7 @@ cp_build_unary_op (enum tree_code code, tree xarg,
     }
 
   if (complain & tf_error)
-    error ("%s", errstring);
+    error_at (location, "%s", errstring);
   return error_mark_node;
 }
 
@@ -7038,7 +7046,8 @@ cp_build_compound_expr (tree lhs, tree rhs, tsubst
   if (type_unknown_p (rhs))
     {
       if (complain & tf_error)
-	error ("no context to resolve type of %qE", rhs);
+	error_at (cp_expr_loc_or_input_loc (rhs),
+		  "no context to resolve type of %qE", rhs);
       return error_mark_node;
     }
   
Index: testsuite/g++.dg/cpp1z/bool-increment1.C
===================================================================
--- testsuite/g++.dg/cpp1z/bool-increment1.C	(revision 278692)
+++ testsuite/g++.dg/cpp1z/bool-increment1.C	(working copy)
@@ -5,10 +5,10 @@ fn (bool b)
 {
   int r = 0;
 
-  r += b++; // { dg-error "use of an operand of type .bool. in .operator\\+\\+. is forbidden in" }
-  r += ++b; // { dg-error "use of an operand of type .bool. in .operator\\+\\+. is forbidden in" }
-  r += b--; // { dg-error "use of an operand of type .bool. in .operator--. is forbidden" }
-  r += --b; // { dg-error "use of an operand of type .bool. in .operator--. is forbidden" }
+  r += b++; // { dg-error "8:use of an operand of type .bool. in .operator\\+\\+. is forbidden in" }
+  r += ++b; // { dg-error "10:use of an operand of type .bool. in .operator\\+\\+. is forbidden in" }
+  r += b--; // { dg-error "8:use of an operand of type .bool. in .operator--. is forbidden" }
+  r += --b; // { dg-error "10:use of an operand of type .bool. in .operator--. is forbidden" }
 
   return r;
 }
Index: testsuite/g++.dg/expr/bitfield3.C
===================================================================
--- testsuite/g++.dg/expr/bitfield3.C	(revision 278692)
+++ testsuite/g++.dg/expr/bitfield3.C	(working copy)
@@ -7,6 +7,6 @@ struct S {
 S s;
 
 void f() {
-  s.x--; // { dg-error "use of an operand of type .bool." }
-  --s.x; // { dg-error "use of an operand of type .bool." }
+  s.x--; // { dg-error "5:use of an operand of type .bool." }
+  --s.x; // { dg-error "7:use of an operand of type .bool." }
 }
Index: testsuite/g++.dg/expr/bitfield4.C
===================================================================
--- testsuite/g++.dg/expr/bitfield4.C	(revision 278692)
+++ testsuite/g++.dg/expr/bitfield4.C	(working copy)
@@ -14,8 +14,8 @@ template <>
 void f(bool) {} 
 
 int main() {
-  f(s.x++); // { dg-warning "deprecated" "" { target { ! c++17 } } }
+  f(s.x++); // { dg-warning "7:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
   // { dg-error "forbidden" "" { target c++17 } .-1 }
-  f(++s.x); // { dg-warning "deprecated" "" { target { ! c++17 } } }
+  f(++s.x); // { dg-warning "9:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
   // { dg-error "forbidden" "" { target c++17 } .-1 }
 }
Index: testsuite/g++.dg/expr/bitfield5.C
===================================================================
--- testsuite/g++.dg/expr/bitfield5.C	(revision 278692)
+++ testsuite/g++.dg/expr/bitfield5.C	(working copy)
@@ -9,11 +9,11 @@ struct S {
 S s;
 
 int main() {
-  s.x++; // { dg-warning "deprecated" "" { target { ! c++17 } } }
+  s.x++; // { dg-warning "5:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
   // { dg-error "forbidden" "" { target c++17 } .-1 }
   if (s.x != 1)
     return 1;
-  ++s.x; // { dg-warning "deprecated" "" { target { ! c++17 } } }
+  ++s.x; // { dg-warning "7:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
   // { dg-error "forbidden" "" { target c++17 } .-1 }
   if (s.x != 1)
     return 2;
Index: testsuite/g++.dg/expr/bitfield6.C
===================================================================
--- testsuite/g++.dg/expr/bitfield6.C	(revision 278692)
+++ testsuite/g++.dg/expr/bitfield6.C	(working copy)
@@ -7,6 +7,6 @@ struct S {
 S s;
 
 void f() {
-  ++s.x = false; // { dg-warning "deprecated" "" { target { ! c++17 } } }
+  ++s.x = false; // { dg-warning "7:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
   // { dg-error "forbidden" "" { target c++17 } .-1 }
 }
Index: testsuite/g++.dg/expr/bool1.C
===================================================================
--- testsuite/g++.dg/expr/bool1.C	(revision 278692)
+++ testsuite/g++.dg/expr/bool1.C	(working copy)
@@ -11,10 +11,10 @@ int main()
   my_bool b = false;
   int i;
 
-  b++; // { dg-warning "deprecated" "" { target { ! c++17 } } }
-  // { dg-error "forbidden" "" { target c++17 } .-1 }
-  b++; // { dg-warning "deprecated" "" { target { ! c++17 } } }
-  // { dg-error "forbidden" "" { target c++17 } .-1 }
+  b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
+  // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
+  b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
+  // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
   i = b;
   if (i != 1)
     abort ();
Index: testsuite/g++.dg/expr/bool2.C
===================================================================
--- testsuite/g++.dg/expr/bool2.C	(revision 278692)
+++ testsuite/g++.dg/expr/bool2.C	(working copy)
@@ -7,7 +7,7 @@ typedef bool my_bool;
 int main()
 {
   my_bool b = false;
-  b--; // { dg-error "" }
+  b--; // { dg-error "3:use of an operand of type .bool. in .operator\\-\\-. is forbidden" }
   return 0;
 }
 
Index: testsuite/g++.dg/expr/bool3.C
===================================================================
--- testsuite/g++.dg/expr/bool3.C	(revision 278692)
+++ testsuite/g++.dg/expr/bool3.C	(working copy)
@@ -11,11 +11,11 @@ int main()
   my_bool b = false;
   int i;
 
-  b++; // { dg-warning "deprecated" "" { target { ! c++17 } } }
-  // { dg-error "forbidden" "" { target c++17 } .-1 }
+  b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
+  // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
   // { dg-warning ".volatile.-qualified type is deprecated" "" { target c++2a } .-2 }
-  b++; // { dg-warning "deprecated" "" { target { ! c++17 } } }
-  // { dg-error "forbidden" "" { target c++17 } .-1 }
+  b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
+  // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
   // { dg-warning ".volatile.-qualified type is deprecated" "" { target c++2a } .-2 }
   i = b;
   if (i != 1)
Index: testsuite/g++.dg/expr/bool4.C
===================================================================
--- testsuite/g++.dg/expr/bool4.C	(revision 278692)
+++ testsuite/g++.dg/expr/bool4.C	(working copy)
@@ -7,7 +7,7 @@ typedef volatile bool my_bool;
 int main()
 {
   my_bool b = false;
-  b--; // { dg-error "" }
+  b--; // { dg-error "3:use of an operand of type .bool. in .operator\\-\\-. is forbidden" }
   // { dg-warning ".volatile.-qualified type is deprecated" "" { target c++2a } .-1 }
   return 0;
 }
Index: testsuite/g++.dg/expr/lval3.C
===================================================================
--- testsuite/g++.dg/expr/lval3.C	(revision 278692)
+++ testsuite/g++.dg/expr/lval3.C	(working copy)
@@ -4,5 +4,5 @@ f()
 {
   bool i = 0;
   i++ = 3; // { dg-error "" }
-  // { dg-warning "deprecated" "" { target { ! c++17 } } .-1 }
+  // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } .-1 }
 }
Index: testsuite/g++.dg/other/error18.C
===================================================================
--- testsuite/g++.dg/other/error18.C	(revision 278692)
+++ testsuite/g++.dg/other/error18.C	(working copy)
@@ -7,5 +7,5 @@ struct A
 
 void f(A a)
 {
-  a.b--; // { dg-error "use of an operand of type .bool." }
+  a.b--; // { dg-error "5:use of an operand of type .bool." }
 }
Index: testsuite/g++.dg/warn/Wpointer-arith-1.C
===================================================================
--- testsuite/g++.dg/warn/Wpointer-arith-1.C	(revision 278692)
+++ testsuite/g++.dg/warn/Wpointer-arith-1.C	(working copy)
@@ -4,10 +4,10 @@
 int main()
 {
   void *pv = 0;
-  pv++;    // { dg-warning "forbids incrementing a pointer" }
+  pv++;    // { dg-warning "3:ISO C\\+\\+ forbids incrementing a pointer" }
 
   typedef void (*pft) ();
 
   pft pf = 0;
-  pf++;    // { dg-warning "forbids incrementing a pointer" }
+  pf++;    // { dg-warning "3:ISO C\\+\\+ forbids incrementing a pointer" }
 }
Index: testsuite/g++.old-deja/g++.bugs/900212_01.C
===================================================================
--- testsuite/g++.old-deja/g++.bugs/900212_01.C	(revision 278692)
+++ testsuite/g++.old-deja/g++.bugs/900212_01.C	(working copy)
@@ -23,17 +23,17 @@ void global_function_0 ()
 {
   p0 = p1 + 3;			// { dg-error "" } 
   p0 = p1 - 3;			// { dg-error "" } 
-  p1++;				/* { dg-error "" } caught by g++ */
-  ++p1;				/* { dg-error "" } caught by g++ */
-  p1--;				/* { dg-error "" } caught by g++ */
-  --p1;				/* { dg-error "" } caught by g++ */
+  p1++;				/* { dg-error "3:no post-increment" } caught by g++ */
+  ++p1;				/* { dg-error "5:no pre-increment" } caught by g++ */
+  p1--;				/* { dg-error "3:no post-decrement" } caught by g++ */
+  --p1;				/* { dg-error "5:no pre-decrement" } caught by g++ */
 
   fp0 = fp1 + 3;		// { dg-error "" } 
   fp0 = fp1 - 3;		// { dg-error "" } 
-  fp1++;			/* { dg-error "" } */
-  ++fp1;			/* { dg-error "" } */
-  fp1--;			/* { dg-error "" } */
-  --fp1;			/* { dg-error "" } */
+  fp1++;			/* { dg-error "3:no post-increment" } */
+  ++fp1;			/* { dg-error "5:no pre-increment" } */
+  fp1--;			/* { dg-error "3:no post-decrement" } */
+  --fp1;			/* { dg-error "5:no pre-decrement" } */
 }
 
 int main () { return 0; }
Index: testsuite/g++.old-deja/g++.bugs/900428_02.C
===================================================================
--- testsuite/g++.old-deja/g++.bugs/900428_02.C	(revision 278692)
+++ testsuite/g++.old-deja/g++.bugs/900428_02.C	(working copy)
@@ -15,13 +15,13 @@ void (*fp) ();
 
 void test ()
 {
-  vp++;		/* { dg-error "" } */
-  ++vp;		/* { dg-error "" } */
-  vp--;		/* { dg-error "" } */
-  --vp;		/* { dg-error "" } */
+  vp++;		/* { dg-error "3:ISO C\\+\\+ forbids incrementing" } */
+  ++vp;		/* { dg-error "5:ISO C\\+\\+ forbids incrementing" } */
+  vp--;		/* { dg-error "3:ISO C\\+\\+ forbids decrementing" } */
+  --vp;		/* { dg-error "5:ISO C\\+\\+ forbids decrementing" } */
 
-  fp++;		/* { dg-error "" } */
-  ++fp;		/* { dg-error "" } */
-  fp--;		/* { dg-error "" } */
-  --fp;		/* { dg-error "" } */
+  fp++;		/* { dg-error "3:ISO C\\+\\+ forbids incrementing" } */
+  ++fp;		/* { dg-error "5:ISO C\\+\\+ forbids incrementing" } */
+  fp--;		/* { dg-error "3:ISO C\\+\\+ forbids decrementing" } */
+  --fp;		/* { dg-error "5:ISO C\\+\\+ forbids decrementing" } */
 }
Index: testsuite/g++.old-deja/g++.jason/rfg14.C
===================================================================
--- testsuite/g++.old-deja/g++.jason/rfg14.C	(revision 278692)
+++ testsuite/g++.old-deja/g++.jason/rfg14.C	(working copy)
@@ -8,9 +8,9 @@ int (*fp)();
 void
 test ()
 {
-    vp++;               /* { dg-error "" } incrementing void * */
-    ap++;               /* { dg-error "" } incrementing ptr to incomplete type */
-    sp++;               /* { dg-error "" } incrementing ptr to incomplete type */
-    up++;               /* { dg-error "" } incrementing ptr to incomplete type */
-    fp++;               /* { dg-error "" } incrementing ptr to function */
+    vp++;               /* { dg-error "5:ISO C\\+\\+ forbids incrementing" } incrementing void * */
+    ap++;               /* { dg-error "5:cannot increment" } incrementing ptr to incomplete type */
+    sp++;               /* { dg-error "5:cannot increment" } incrementing ptr to incomplete type */
+    up++;               /* { dg-error "5:cannot increment" } incrementing ptr to incomplete type */
+    fp++;               /* { dg-error "5:ISO C\\+\\+ forbids incrementing" } incrementing ptr to function */
 }
Index: testsuite/g++.old-deja/g++.other/overload11.C
===================================================================
--- testsuite/g++.old-deja/g++.other/overload11.C	(revision 278692)
+++ testsuite/g++.old-deja/g++.other/overload11.C	(working copy)
@@ -38,8 +38,8 @@ int main (int argc, char **argv)
   
   // 13.3.1.1 indicates that the following are errors -- the primary expression
   // is not the name of a function.
-  (0, ovl) (1);             // { dg-error "" } not suitable for overload resolution
-  (0, &ovl) (1);            // { dg-error "" } not suitable for overload resolution
+  (0, ovl) (1);             // { dg-error "7:no context" } not suitable for overload resolution
+  (0, &ovl) (1);            // { dg-error "7:no context" } not suitable for overload resolution
   (argc ? ovl : ovl) (1);   // { dg-error "" } not suitable for overload resolution
   (argc ? &ovl : &ovl) (1); // { dg-error "" } not suitable for overload resolution
   
@@ -52,15 +52,15 @@ int main (int argc, char **argv)
   
   ptr = (ovl);              // ok
   ptr = (&ovl);             // ok
-  ptr = (0, ovl);           // ok { dg-error "no context" }
-  ptr = (0, &ovl);          // ok { dg-error "no context" }
+  ptr = (0, ovl);           // ok { dg-error "13:no context" }
+  ptr = (0, &ovl);          // ok { dg-error "13:no context" }
   ptr = (argc ? ovl : ovl); // ok { dg-error "no context" }
   ptr = (argc ? &ovl : &ovl);// ok { dg-error "no context" }
   
   vptr = (ovl);              // { dg-error "" } no matching candidates
   vptr = (&ovl);             // { dg-error "" } no matching candidates
-  vptr = (0, ovl);           // { dg-error "" } no matching candidates
-  vptr = (0, &ovl);          // { dg-error "" } no matching candidates
+  vptr = (0, ovl);           // { dg-error "14:no context" } no matching candidates
+  vptr = (0, &ovl);          // { dg-error "14:no context" } no matching candidates
   vptr = (argc ? ovl : ovl); // { dg-error "" } no matching candidates
   vptr = (argc ? &ovl : &ovl);// { dg-error "" } no matching candidates
   
@@ -81,11 +81,11 @@ int main (int argc, char **argv)
   static_cast<void>(ovl);        // { dg-error "" } not suitable for overload
   static_cast<void>(&ovl);       // { dg-error "" } not suitable for overload
   ((void)1, f);             // { dg-warning "" "" { xfail *-*-* } } not a call
-  ((void)1, ovl);           // { dg-error "" } not suitable for overload
-  ((void)1, &ovl);          // { dg-error "" } not suitable for overload
+  ((void)1, ovl);           // { dg-error "13:no context" } not suitable for overload
+  ((void)1, &ovl);          // { dg-error "13:no context" } not suitable for overload
   (void)((void)1, f);           // ok
-  (void)((void)1, ovl);         // { dg-error "" } not suitable for overload
-  (void)((void)1, &ovl);        // { dg-error "" } not suitable for overload
+  (void)((void)1, ovl);         // { dg-error "19:no context" } not suitable for overload
+  (void)((void)1, &ovl);        // { dg-error "19:no context" } not suitable for overload
 
   return 0;
 }
