c++: Diagnose cv-qualified decltype(auto) [PR79815]
authorMarek Polacek <polacek@redhat.com>
Wed, 8 Jul 2020 23:45:34 +0000 (19:45 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 17 Jul 2020 15:43:39 +0000 (11:43 -0400)
commite7f0873a9c4ebccd078fc5330866efe0cd4c1309
treeaa7a95a573fcb4e35b6dfd38f472cb714fa65944
parentc08ff9f81914c6028c586e5ecdec3736cd9a4fec
c++: Diagnose cv-qualified decltype(auto) [PR79815]

"If the placeholder is the decltype(auto) type-specifier, T shall be the
placeholder alone." but we weren't detecting "const decltype(auto)".

I've just expanded the existing diagnostic detecting "decltype(auto) &"
and similar.

gcc/cp/ChangeLog:

PR c++/79815
* decl.c (grokdeclarator): Detect cv-qual decltype(auto).
* pt.c (do_auto_deduction): Likewise.

gcc/testsuite/ChangeLog:

PR c++/79815
* g++.dg/cpp1y/auto-fn59.C: New test.
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1y/auto-fn59.C [new file with mode: 0644]