https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83871
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- Author: msebor Date: Tue Feb 27 22:28:21 2018 New Revision: 258045 URL: https://gcc.gnu.org/viewcvs?rev=258045&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/Wmissing-attributes.C trunk/gcc/testsuite/g++.dg/ext/attr-const-pure.C trunk/gcc/testsuite/g++.dg/ext/attr-const.C trunk/gcc/testsuite/g++.dg/ext/attr-deprecated-2.C trunk/gcc/testsuite/g++.dg/ext/attr-malloc-2.C trunk/gcc/testsuite/g++.dg/ext/attr-malloc.C trunk/gcc/testsuite/g++.dg/ext/attr-noinline-2.C trunk/gcc/testsuite/g++.dg/ext/attr-noinline.C trunk/gcc/testsuite/g++.dg/ext/attr-nonnull.C trunk/gcc/testsuite/g++.dg/ext/attr-noreturn-2.C trunk/gcc/testsuite/g++.dg/ext/attr-noreturn.C trunk/gcc/testsuite/g++.dg/ext/attr-nothrow-2.C trunk/gcc/testsuite/g++.dg/ext/attr-nothrow.C trunk/gcc/testsuite/g++.dg/ext/attr-optimize.C trunk/gcc/testsuite/g++.dg/ext/attr-pure.C trunk/gcc/testsuite/g++.dg/ext/attr-returns-nonnull.C trunk/gcc/testsuite/g++.dg/ext/attr-warning.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c.opt trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/pt.c trunk/gcc/doc/invoke.texi trunk/gcc/print-tree.c trunk/gcc/testsuite/ChangeLog