Index: cp/parser.c =================================================================== --- cp/parser.c (revision 203915) +++ cp/parser.c (working copy) @@ -21426,6 +21443,9 @@ /* C++11 noreturn attribute is equivalent to GNU's. */ if (is_attribute_p ("noreturn", attr_id)) TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu"); + /* C++14 deprecated attribute is equivalent to GNU's. */ + else if (cxx_dialect >= cxx1y && is_attribute_p ("deprecated", attr_id)) + TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu"); } /* Now parse the optional argument clause of the attribute. */ Index: testsuite/g++.dg/cpp1y/attr-deprecated.C =================================================================== --- testsuite/g++.dg/cpp1y/attr-deprecated.C (revision 0) +++ testsuite/g++.dg/cpp1y/attr-deprecated.C (working copy) @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options -std=c++1y } + +class [[deprecated]] A +{ +}; + +[[deprecated]] +int +foo(int n) +{ + return 42 + n; +} + +class [[deprecated("B has been superceded by C")]] B +{ +}; + +[[deprecated("bar is unsafe; use foobar instead")]] +int +bar(int n) +{ + return 42 + n - 1; +} + +#if __cplusplus > 201103L + +// Deprecate C for C++14 onwards. +class [[deprecated]] C; + +// Deprecate foobar for C++14 onwards. +[[deprecated]] +int +foobar(int n); + +#endif + +class C +{ +}; + +int +foobar(int n) +{ + return 43 + n - 1; +} + +int +main() +{ + A aaa; // { dg-warning "is deprecated" } + int n = foo(12); // { dg-warning "is deprecated" } + + B bbb; // { dg-warning "is deprecated" "B has been superceded by C" } + int m = bar(666); // { dg-warning "is deprecated" "bar is unsafe; use foobar instead" } + + C ccc; // { dg-warning "is deprecated" } + int l = foobar(8); // { dg-warning "is deprecated" } +} Index: testsuite/g++.dg/cpp1y/attr-deprecated-neg.C =================================================================== --- testsuite/g++.dg/cpp1y/attr-deprecated-neg.C (revision 0) +++ testsuite/g++.dg/cpp1y/attr-deprecated-neg.C (working copy) @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options -std=c++11 } + +class [[deprecated]] A // { dg-warning "attribute directive ignored" } +{ +}; + +[[deprecated]] +int +foo(int n) // { dg-warning "attribute directive ignored" } +{ + return 42 + n; +} + +class [[deprecated("B has been superceded by C")]] B // { dg-warning "attribute directive ignored" } +{ +}; + +[[deprecated("bar is unsafe; use foobar instead")]] +int +bar(int n) // { dg-warning "attribute directive ignored" } +{ + return 42 + n - 1; +} + +#if __cplusplus > 201103L + +// Deprecate C for C++14 onwards. +class [[deprecated]] C; + +// Deprecate foobar for C++14 onwards. +[[deprecated]] +int +foobar(int n); + +#endif + +class C +{ +}; + +int +foobar(int n) +{ + return 43 + n - 1; +} + +int +main() +{ + A aaa; + int n = foo(12); + + B bbb; + int m = bar(666); + + C ccc; + int l = foobar(8); +}