c++: Improve dump_decl for standard concepts
authorPatrick Palka <ppalka@redhat.com>
Mon, 10 Feb 2020 15:48:27 +0000 (10:48 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 11 Feb 2020 01:43:49 +0000 (20:43 -0500)
commit91f4fc40bcf666eb57d566198981dc8e8eff9ccb
tree3a83045dfc372022e579cc2b7a17764df7651c94
parent9053a18fc77781f64ed66d1bd761bdefb68b871a
c++: Improve dump_decl for standard concepts

This patch improves the pretty printing of standard concept definitions in error
messages.  In particular, standard concepts are now printed qualified whenever
appropriate, and the "concept" specifier is printed only when the
TFF_DECL_SPECIFIERS flag is specified.

In the below test, the first error message changes from
  9:15: error: ‘b’ was not declared in this scope; did you mean ‘concept b’?
to
  9:15: error: ‘b’ was not declared in this scope; did you mean ‘a::b’?

gcc/cp/ChangeLog:

* error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
(dump_simple_decl): Handle standard concept definitions as well as
variable concept definitions.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts6.C: New test.
gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/concepts6.C [new file with mode: 0644]