From cfe871e3ec6a28f5fb7602ab44407613b6787ef2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 17 Nov 2019 07:12:01 +0100 Subject: [PATCH] method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> to print the decl. * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> to print the decl. (lookup_comparison_category): Use %qD instead of % to print the decl. * g++.dg/cpp2a/spaceship-err3.C: New test. From-SVN: r278375 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/method.c | 4 ++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 429ffd69e47..4730d792c68 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2019-11-17 Jakub Jelinek + + * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%> + to print the decl. + (lookup_comparison_category): Use %qD instead of % to print + the decl. + 2019-11-15 Paolo Carlini * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter diff --git a/gcc/cp/method.c b/gcc/cp/method.c index acba6c6da8c..a707940cacc 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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 ("% is not a type", decl); + error ("%qD is not a type", decl); inform (input_location, "forming type of %qs", "operator<=>"); } return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef5bd71af8e..0a4ce6d845f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-11-17 Jakub Jelinek + + * g++.dg/cpp2a/spaceship-err3.C: New test. + 2019-11-16 Richard Sandiford * 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 index 00000000000..e756ebca945 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err3.C @@ -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 } -- 2.30.2