PR c++/83871 - wrong code for attribute const and pure on distinct template specializ...
authorMartin Sebor <msebor@redhat.com>
Tue, 27 Feb 2018 22:28:21 +0000 (22:28 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 27 Feb 2018 22:28:21 +0000 (15:28 -0700)
commitd4cfd486ebe3fadb7a67c53c24843770a1d8ba72
tree62d47ef8a95d209046feec191ee55fbe477706c7
parent1c89478aef3ef9576f40013c3969179b3189ee95
PR c++/83871 - wrong code for attribute const and pure on distinct template specializations

PR c++/83871 - wrong code for attribute const and pure on distinct template specializations
PR c++/83503 - [8 Regression] bogus -Wattributes for const and pure on function template specialization

gcc/ChangeLog:

PR c++/83871
* gcc/doc/invoke.texi (-Wmissing-attributes): New option.
* gcc/print-tree.c (print_node): Handle DECL_UNINLINABLE.

gcc/c-family/ChangeLog:

PR c++/83871
* c.opt (-Wmissing-attributes): New option.

gcc/cp/ChangeLog:

PR c++/83871
PR c++/83503
* cp-tree.h (warn_spec_missing_attributes): New function.
((check_explicit_specialization): Add an argument.  Call the above
function.
* decl.c (duplicate_decls): Avoid applying primary function template's
attributes to its explicit specializations.
cp/pt.c (warn_spec_missing_attributes): Define.

gcc/testsuite/ChangeLog:

PR c++/83871
PR c++/83503
* g++.dg/Wmissing-attributes.C: New test.
* g++.dg/ext/attr-const-pure.C: New test.
* g++.dg/ext/attr-const.C: New test.
* g++.dg/ext/attr-deprecated-2.C: New test.
* g++.dg/ext/attr-malloc-2.C: New test.
* g++.dg/ext/attr-malloc.C: New test.
* g++.dg/ext/attr-noinline-2.C: New test.
* g++.dg/ext/attr-noinline.C: New test.
* g++.dg/ext/attr-nonnull.C: New test.
* g++.dg/ext/attr-noreturn-2.C: New test.
* g++.dg/ext/attr-noreturn.C: New test.
* g++.dg/ext/attr-nothrow-2.C: New test.
* g++.dg/ext/attr-nothrow.C: New test.
* g++.dg/ext/attr-optimize.C: New test.
* g++.dg/ext/attr-pure.C: New test.
* g++.dg/ext/attr-returns-nonnull.C: New test.
* g++.dg/ext/attr-warning.C: New test.

From-SVN: r258045
27 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c
gcc/doc/invoke.texi
gcc/print-tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/Wmissing-attributes.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-const-pure.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-const.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-deprecated-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-malloc-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-malloc.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-noinline-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-noinline.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-nonnull.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-noreturn-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-noreturn.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-nothrow-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-nothrow.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-optimize.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-pure.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-returns-nonnull.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/attr-warning.C [new file with mode: 0644]