c++: Treat in-class default/delete as definitions.
authorJason Merrill <jason@redhat.com>
Tue, 16 Jun 2020 04:20:58 +0000 (00:20 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 17 Jun 2020 19:08:42 +0000 (15:08 -0400)
commitda2c9054f1596b71e3c81efd62b6cef348e445b4
tree59b9bf926db8129c48e0f022ac5217fd6e932596
parentd2384b7b24f8557b66f6958a05ea99ff4307e75c
c++: Treat in-class default/delete as definitions.

We were complaining about a constrained defaulted non-template friend in a
template class because funcdef_flag wasn't set.  grokdeclarator would set it
for default/delete, but grokfield wasn't passing the 'initialized' values
needed.  Fixing that revealed some errors in existing tests that we weren't
diagnosing.  Since we accepted them for so long, I'm reducing the error to a
pedwarn to ease compiler upgrade.

gcc/cp/ChangeLog:

* decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
* decl.c (duplicate_decls): Reduce error for delete
after earlier declaration to pedwarn.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/pr62101.C: Expect error.
* g++.dg/cpp0x/pr80259.C: Expect error.
* g++.dg/cpp2a/concepts-friend8.C: New test.
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/testsuite/g++.dg/cpp0x/pr62101.C
gcc/testsuite/g++.dg/cpp0x/pr80259.C
gcc/testsuite/g++.dg/cpp2a/concepts-friend8.C [new file with mode: 0644]