]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: handle decltype in nested-name-spec printing [PR118139]
authorMarek Polacek <polacek@redhat.com>
Thu, 19 Dec 2024 22:47:03 +0000 (17:47 -0500)
committerMarek Polacek <polacek@redhat.com>
Wed, 15 Jan 2025 15:02:13 +0000 (10:02 -0500)
commit1bc474f60fde7aba2e00d00f9fa491aff243ecba
tree741710c5c23325437a65a5d96d292f9ce0a430f6
parent9cc31b4e07aab75fcbc81b3a9bcaaa21d2c3bdb2
c++: handle decltype in nested-name-spec printing [PR118139]

Compiling this test, we emit:

  error: 'static void CW<T>::operator=(int) requires requires(typename'decltype_type' not supported by pp_cxx_unqualified_id::type x) {x;}' must be a non-static member function

where the DECLTYPE_TYPE isn't printed properly.  This patch fixes that
to print:

error: 'static void CW<T>::operator=(int) requires requires(typename decltype(T())::type x) {x;}' must be a non-static member function

PR c++/118139

gcc/cp/ChangeLog:

* cxx-pretty-print.cc (pp_cxx_nested_name_specifier): Handle
a computed-type-specifier.

gcc/testsuite/ChangeLog:

* g++.dg/diagnostic/decltype1.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/cxx-pretty-print.cc
gcc/testsuite/g++.dg/diagnostic/decltype1.C [new file with mode: 0644]