diff options
author | Jason Merrill <jason@redhat.com> | 2018-06-28 16:22:21 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-06-28 16:22:21 -0400 |
commit | b8be1451289da4dfd69673b768bdc0e901a0fcef (patch) | |
tree | ceb6b7907d2d5d0543187d9b22b1dd90048c9360 /gcc | |
parent | 02fa47a905c1e06a5490032cc4bd4f733f4a0453 (diff) | |
download | gcc-b8be1451289da4dfd69673b768bdc0e901a0fcef.zip gcc-b8be1451289da4dfd69673b768bdc0e901a0fcef.tar.gz gcc-b8be1451289da4dfd69673b768bdc0e901a0fcef.tar.bz2 |
PR c++/86342 - -Wdeprecated-copy and system headers.
* decl2.c (cp_warn_deprecated_use): Don't warn about declarations
in system headers.
From-SVN: r262231
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/depr-copy2.C | 17 |
3 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 040a84d..862b737 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-06-28 Jason Merrill <jason@redhat.com> + + PR c++/86342 - -Wdeprecated-copy and system headers. + * decl2.c (cp_warn_deprecated_use): Don't warn about declarations + in system headers. + 2018-06-27 David Malcolm <dmalcolm@redhat.com> PR c++/86329 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5fc6369..e06ffa6 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -5208,8 +5208,10 @@ cp_warn_deprecated_use (tree decl, tsubst_flags_t complain) && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) && copy_fn_p (decl)) { - warned = warning (OPT_Wdeprecated_copy, - "implicitly-declared %qD is deprecated", decl); + /* Don't warn about system library classes (c++/86342). */ + if (!DECL_IN_SYSTEM_HEADER (decl)) + warned = warning (OPT_Wdeprecated_copy, + "implicitly-declared %qD is deprecated", decl); if (warned) { tree ctx = DECL_CONTEXT (decl); diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy2.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy2.C new file mode 100644 index 0000000..cef18b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy2.C @@ -0,0 +1,17 @@ +// PR c++/86342 +// { dg-options -Wdeprecated-copy } + +# 1 "deprcopy.cc" +# 1 "deprcopy.h" 1 3 + +struct X { + X() { } + ~X() { } +}; +# 2 "deprcopy.cc" 2 + +int main() +{ + X x; + X y = x; +} |