aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2021-12-10 15:38:35 -0500
committerMarek Polacek <polacek@redhat.com>2021-12-15 17:47:43 -0500
commit06d5dcef72542baf49ac245cfde2ad7ecef0916b (patch)
treee988e7ac830e95c16f9028d6a3e83d67ac84afcc /libiberty
parent45b768cb80930c0beeb735727349c44ec66f7dd2 (diff)
downloadgcc-06d5dcef72542baf49ac245cfde2ad7ecef0916b.zip
gcc-06d5dcef72542baf49ac245cfde2ad7ecef0916b.tar.gz
gcc-06d5dcef72542baf49ac245cfde2ad7ecef0916b.tar.bz2
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.
Diffstat (limited to 'libiberty')
0 files changed, 0 insertions, 0 deletions