typeck.c (build_x_unary_op): Use the location_t argument in three error_at.
authorPaolo Carlini <paolo@gcc.gnu.org>
Tue, 29 Oct 2019 22:31:08 +0000 (22:31 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 29 Oct 2019 22:31:08 +0000 (22:31 +0000)
/cp
2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

* typeck.c (build_x_unary_op): Use the location_t argument in
three error_at.

/testsuite
2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/other/ptrmem8.C: Test locations too.
* g++.dg/template/dtor6.C: Likewise.

From-SVN: r277595

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/ptrmem8.C
gcc/testsuite/g++.dg/template/dtor6.C

index 6b1937557fff6c386b4b0f6e11cb35bd2e46b150..bc2b48eea750920ff1ee92eccca62facc7587c1f 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (build_x_unary_op): Use the location_t argument in
+       three error_at.
+
 2019-10-29  Marek Polacek  <polacek@redhat.com>
 
        PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
@@ -25,8 +30,8 @@
 
        * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
        * decl.c (cxx_simulate_builtin_function_decl): New function.
-       * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL): Define
-       to the above.
+       * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
+       Define to the above.
 
 2019-10-28  Martin Sebor  <msebor@redhat.com>
 
index 627dfc2a4fc9068ee4c3ce07d1c6907f32a7b45f..ad46d42d215b3e45ca83931a51a52ba70ad52fdd 100644 (file)
@@ -5829,10 +5829,10 @@ build_x_unary_op (location_t loc, enum tree_code code, cp_expr xarg,
          if (DECL_CONSTRUCTOR_P (fn) || DECL_DESTRUCTOR_P (fn))
            {
              if (complain & tf_error)
-               error (DECL_CONSTRUCTOR_P (fn)
-                      ? G_("taking address of constructor %qD")
-                      : G_("taking address of destructor %qD"),
-                      fn);
+               error_at (loc, DECL_CONSTRUCTOR_P (fn)
+                         ? G_("taking address of constructor %qD")
+                         : G_("taking address of destructor %qD"),
+                         fn);
              return error_mark_node;
            }
        }
@@ -5847,19 +5847,19 @@ build_x_unary_op (location_t loc, enum tree_code code, cp_expr xarg,
            {
              if (complain & tf_error)
                {
-                 error ("invalid use of %qE to form a "
-                        "pointer-to-member-function", xarg.get_value ());
+                 error_at (loc, "invalid use of %qE to form a "
+                           "pointer-to-member-function", xarg.get_value ());
                  if (TREE_CODE (xarg) != OFFSET_REF)
-                   inform (input_location, "  a qualified-id is required");
+                   inform (loc, "  a qualified-id is required");
                }
              return error_mark_node;
            }
          else
            {
              if (complain & tf_error)
-               error ("parentheses around %qE cannot be used to form a"
-                      " pointer-to-member-function",
-                      xarg.get_value ());
+               error_at (loc, "parentheses around %qE cannot be used to "
+                         "form a pointer-to-member-function",
+                         xarg.get_value ());
              else
                return error_mark_node;
              PTRMEM_OK_P (xarg) = 1;
index db443f717290ebf22b4125c9f4706c0a1dbaa569..1c478fe2ad08256cba931e21f8181ab3174bf28c 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/other/ptrmem8.C: Test locations too.
+       * g++.dg/template/dtor6.C: Likewise.
+
 2019-10-29  Marek Polacek  <polacek@redhat.com>
 
        PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
index d0b0ba7228ea42575a265ddd622dfeb4bb324854..755b0ad8647312f201651baed9b0c544e2978fe5 100644 (file)
@@ -6,11 +6,11 @@ struct A {};
 template<int> void foo(void (A::* f)())
 {
   A a;
-  &(a.*f);     // { dg-error "invalid use of\[^\n\]*\\.\\*\[^\n\]*to form|qualified-id is required" }
+  &(a.*f);     // { dg-error "3:invalid use of\[^\n\]*\\.\\*\[^\n\]*to form|qualified-id is required" }
 }
 
 template<int> void bar(void (A::* f)())
 {
   A *p;
-  &(p->*f);    // { dg-error "invalid use of\[^\n\]*->\\*\[^\n\]*to form|qualified-id is required" }
+  &(p->*f);    // { dg-error "3:invalid use of\[^\n\]*->\\*\[^\n\]*to form|qualified-id is required" }
 }
index c44b780294c21f9b189fd2b03ed0c0d97a028cbc..a3d778a1ea1114a5b3cabb318cd3075b295dc124 100644 (file)
@@ -5,12 +5,12 @@ template<int> struct A
   static int i;
 };
 
-template<int N> int A<N>::i = { A::~A }; // { dg-error "non-static member function" }
+template<int N> int A<N>::i = { A::~A }; // { dg-error "36:invalid use of non-static member function" }
 
 template class A<0>;
 
 struct X { };
 
-int i1 = X::~X;                        // { dg-error "non-static member function" }
-int i2 = &X::~X;               // { dg-error "address of destructor" }
-int i3 = &A<0>::~A;            // { dg-error "address of destructor" }
+int i1 = X::~X;                        // { dg-error "13:invalid use of non-static member function" }
+int i2 = &X::~X;               // { dg-error "10:taking address of destructor" }
+int i3 = &A<0>::~A;            // { dg-error "10:taking address of destructor" }