c++: Fix printing of decltype(nullptr) [PR97517]
authorMarek Polacek <polacek@redhat.com>
Tue, 8 Dec 2020 21:44:53 +0000 (16:44 -0500)
committerMarek Polacek <polacek@redhat.com>
Wed, 9 Dec 2020 14:28:07 +0000 (09:28 -0500)
commitfe70679b80f5e6193a0976be41b68d590c7cb2f3
treecb27930bc49389c043a7adb431c4a28d616be061
parent33d2f41785b24ad43c5a9d52aa289e33ac838f86
c++: Fix printing of decltype(nullptr) [PR97517]

The C++ printer doesn't handle NULLPTR_TYPE, so we issue the ugly
"'nullptr_type' not supported by...".  Since NULLPTR_TYPE is
decltype(nullptr), it seemed reasonable to handle it where we
handle DECLTYPE_TYPE, that is, in the simple-type-specifier handler.

gcc/cp/ChangeLog:

PR c++/97517
* cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier): Handle
NULLPTR_TYPE.
(pp_cxx_type_specifier_seq): Likewise.
(cxx_pretty_printer::type_id): Likewise.

gcc/testsuite/ChangeLog:

PR c++/97517
* g++.dg/diagnostic/nullptr.C: New test.
gcc/cp/cxx-pretty-print.c
gcc/testsuite/g++.dg/diagnostic/nullptr.C [new file with mode: 0644]