method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> to print the decl.
authorJakub Jelinek <jakub@redhat.com>
Sun, 17 Nov 2019 06:12:01 +0000 (07:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 17 Nov 2019 06:12:01 +0000 (07:12 +0100)
* method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
to print the decl.
(lookup_comparison_category): Use %qD instead of %<std::%D%> to print
the decl.

* g++.dg/cpp2a/spaceship-err3.C: New test.

From-SVN: r278375

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C [new file with mode: 0644]

index 429ffd69e474521f0031f1683372aa787fa24ef9..4730d792c68edd48e82510e8699aad79dd390ec0 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
+       to print the decl.
+       (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
+       the decl.
+
 2019-11-15  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
index acba6c6da8ce38f14eb5259ecf9b71b9aae95fd6..a707940cacceb34335e77d635caf3fdeb176e822 100644 (file)
@@ -924,7 +924,7 @@ lookup_comparison_result (tree type, const char *name_str,
          if (decl == error_mark_node || TREE_CODE (decl) == TREE_LIST)
            qualified_name_lookup_error (type, name, decl, input_location);
          else
-           error ("%<%T::%D%> is not a static data member", type, decl);
+           error ("%qD is not a static data member", decl);
          inform (input_location, "determining value of %qs", "operator<=>");
        }
       return error_mark_node;
@@ -951,7 +951,7 @@ lookup_comparison_category (comp_cat_tag tag,
          if (decl == error_mark_node || TREE_CODE (decl) == TREE_LIST)
            qualified_name_lookup_error (std_node, name, decl, input_location);
          else
-           error ("%<std::%D%> is not a type", decl);
+           error ("%qD is not a type", decl);
          inform (input_location, "forming type of %qs", "operator<=>");
        }
       return error_mark_node;
index ef5bd71af8e9b3617cd2e14386644a496179a03b..0a4ce6d845f5464f3665d9af97a25a7531dc8886 100644 (file)
@@ -1,3 +1,7 @@
+2019-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/cpp2a/spaceship-err3.C: New test.
+
 2019-11-16  Richard Sandiford  <richard.sandiford@arm.com>
 
        * gcc.dg/vect/vect-alias-check-18.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C
new file mode 100644 (file)
index 0000000..e756ebc
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++2a } }
+
+namespace std
+{
+  int strong_ordering;
+  struct partial_ordering {
+    static int equivalent ();
+  };
+}
+
+auto a = 1 <=> 2;      // { dg-error "'std::strong_ordering' is not a type" }
+                       // { dg-message "forming type of 'operator<=>'" "" { target *-*-* } .-1 }
+auto b = 3.0 <=> 4.0;  // { dg-error "'std::partial_ordering::equivalent\\(\\)' is not a static data member" }
+                       // { dg-message "determining value of 'operator<=>'" "" { target *-*-* } .-1 }