aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-04-04 18:09:53 -0400
committerMarek Polacek <polacek@redhat.com>2020-05-20 17:00:06 -0400
commit4b38d56dbac6742b038551a36ec80200313123a1 (patch)
tree7d75adf2b43a0debeada1db1e232ef344aed5d74 /libgcc
parent38a4db21e12816c674406f33d8bc4d064d4211d7 (diff)
downloadgcc-4b38d56dbac6742b038551a36ec80200313123a1.zip
gcc-4b38d56dbac6742b038551a36ec80200313123a1.tar.gz
gcc-4b38d56dbac6742b038551a36ec80200313123a1.tar.bz2
c++: C++20 DR 2237, disallow simple-template-id in cdtor.
This patch implements DR 2237 which says that a simple-template-id is no longer valid as the declarator-id of a constructor or destructor; see [diff.cpp17.class]#2. It is not explicitly stated but out-of-line destructors with a simple-template-id are also meant to be ill-formed now. (Out-of-line constructors like that are invalid since DR1435 I think.) This change only applies to C++20; it is not a DR against C++17. I'm not crazy about the diagnostic in constructors but ISTM that cp_parser_constructor_declarator_p shouldn't print errors. DR 2237 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as the declarator-id of a destructor. (cp_parser_constructor_declarator_p): Reject simple-template-id as the declarator-id of a constructor. * g++.dg/DRs/dr2237.C: New test. * g++.dg/parse/constructor2.C: Add dg-error for C++20. * g++.dg/parse/dtor12.C: Likewise. * g++.dg/parse/dtor4.C: Likewise. * g++.dg/template/dtor4.C: Adjust dg-error. * g++.dg/template/error34.C: Likewise. * g++.old-deja/g++.other/inline15.C: Only run for C++17 and lesses. * g++.old-deja/g++.pt/ctor2.C: Add dg-error for C++20.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions