Go to file
Marek Polacek 06d5dcef72 c++: Allow constexpr decltype(auto) [PR102229]
My r11-2202 was trying to enforce [dcl.type.auto.deduct]/4, which says
"If the placeholder-type-specifier is of the form type-constraint[opt]
decltype(auto), T shall be the placeholder alone."  But this made us
reject 'constexpr decltype(auto)', which, after clarification from CWG,
should be valid.  [dcl.type.auto.deduct]/4 is supposed to be a syntactic
constraint, not semantic, so it's OK that the constexpr marks the object
as const.

As a consequence, checking TYPE_QUALS in do_auto_deduction is too late,
and we have a FIXME there anyway.  So in this patch I'm attempting to
detect 'const decltype(auto)' earlier.  If I'm going to use TYPE_QUALS,
it needs to happen before we mark the object as const due to constexpr,
that is, before grokdeclarator's

  /* A `constexpr' specifier used in an object declaration declares
     the object as `const'.  */
  if (constexpr_p && innermost_code != cdk_function)
    ...

Constrained decltype(auto) was a little problem, hence the TYPENAME
check.  But in a typename context you can't use decltype(auto) anyway,
I think.

	PR c++/102229

gcc/cp/ChangeLog:

	* decl.c (check_decltype_auto): New.
	(grokdeclarator): Call it.
	* pt.c (do_auto_deduction): Don't check decltype(auto) here.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/decltype-auto5.C: New test.
2021-12-15 17:47:43 -05:00
INSTALL
c++tools Daily bump. 2021-10-27 00:16:33 +00:00
config Sync with binutils: GCC: Pass --plugin to AR and RANLIB 2021-12-15 14:18:10 -08:00
contrib Daily bump. 2021-12-07 00:16:23 +00:00
fixincludes Daily bump. 2021-11-24 00:16:29 +00:00
gcc c++: Allow constexpr decltype(auto) [PR102229] 2021-12-15 17:47:43 -05:00
gnattools Daily bump. 2021-10-23 00:16:26 +00:00
gotools
include Daily bump. 2021-12-13 00:16:28 +00:00
intl Daily bump. 2021-11-30 00:16:44 +00:00
libada Daily bump. 2021-10-23 00:16:26 +00:00
libatomic
libbacktrace Daily bump. 2021-11-13 00:16:39 +00:00
libcc1 configure: Account CXXFLAGS in gcc-plugin.m4. 2021-12-15 14:49:59 +00:00
libcody Daily bump. 2021-11-02 00:16:32 +00:00
libcpp Daily bump. 2021-12-05 00:16:28 +00:00
libdecnumber Daily bump. 2021-10-23 00:16:26 +00:00
libffi Daily bump. 2021-11-16 00:16:31 +00:00
libgcc Daily bump. 2021-12-14 00:16:25 +00:00
libgfortran Daily bump. 2021-12-15 00:16:28 +00:00
libgo
libgomp Daily bump. 2021-12-14 00:16:25 +00:00
libiberty Sync with binutils: GCC: Pass --plugin to AR and RANLIB 2021-12-15 14:18:10 -08:00
libitm Daily bump. 2021-11-27 00:16:19 +00:00
libobjc
liboffloadmic Daily bump. 2021-10-20 00:16:43 +00:00
libphobos d: Merge upstream dmd 93108bb9e, druntime 6364e010, phobos 575b67a9b. 2021-12-15 19:51:30 +01:00
libquadmath
libsanitizer Daily bump. 2021-12-07 00:16:23 +00:00
libssp
libstdc++-v3 libstdc++: Overload std::__to_address for __gnu_cxx::__normal_iterator. 2021-12-15 22:28:05 +01:00
libvtv
lto-plugin Daily bump. 2021-12-03 00:17:04 +00:00
maintainer-scripts
zlib Sync with binutils: GCC: Pass --plugin to AR and RANLIB 2021-12-15 14:18:10 -08:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Daily bump. 2021-12-15 00:16:28 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Add myself to write after approval 2021-12-14 15:59:29 +01:00
Makefile.def d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1) 2021-11-30 16:53:28 +01:00
Makefile.in Sync with binutils: Support the PGO build for binutils+gdb 2021-12-15 14:20:49 -08:00
Makefile.tpl Sync with binutils: Support the PGO build for binutils+gdb 2021-12-15 14:20:49 -08:00
README
ar-lib
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Sync with binutils: Support the PGO build for binutils+gdb 2021-12-15 14:20:49 -08:00
configure.ac Sync with binutils: Support the PGO build for binutils+gdb 2021-12-15 14:20:49 -08:00
depcomp
install-sh
libtool-ldflags
libtool.m4 Sync with binutils: GCC: Pass --plugin to AR and RANLIB 2021-12-15 14:18:10 -08:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
symlink-tree
test-driver
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.