public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be?
@ 2021-03-01 14:48 gcc-bugs at marehr dot dialup.fu-berlin.de
2021-03-02 7:32 ` [Bug c++/99318] " rguenth at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: gcc-bugs at marehr dot dialup.fu-berlin.de @ 2021-03-01 14:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Bug ID: 99318
Summary: [10/11 Regression] -Wdeprecated-declarations where
non-should be?
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
Target Milestone: ---
Hello gcc-team,
since gcc 10 the following code throws a deprecation warning, even though it
doesn't use any deprecated code.
```c++
template <typename derived_type>
class alphabet_base
{
[[deprecated("message")]] unsigned char_to_rank_table(char const chr)
{
using index_t = unsigned;
return derived_type::char_to_rank[static_cast<index_t>(chr)];
}
};
```
gives the following warning:
```
<source>: In member function 'unsigned int
alphabet_base<derived_type>::char_to_rank_table(char)':
<source>:7:55: warning: 'unsigned int
alphabet_base<derived_type>::char_to_rank_table(char)' is deprecated: message
[-Wdeprecated-declarations]
7 | return derived_type::char_to_rank[static_cast<index_t>(chr)];
| ^~~~~~~
<source>:4:40: note: declared here
4 | [[deprecated("message")]] unsigned char_to_rank_table(char const
chr)
| ^~~~~~~~~~~~~~~~~~
Compiler returned: 0
```
See https://godbolt.org/z/4cWzMr
Thank you!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10/11 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
@ 2021-03-02 7:32 ` rguenth at gcc dot gnu.org
2021-03-09 13:49 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-02 7:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.3
Keywords| |diagnostic, rejects-valid
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10/11 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
2021-03-02 7:32 ` [Bug c++/99318] " rguenth at gcc dot gnu.org
@ 2021-03-09 13:49 ` jakub at gcc dot gnu.org
2021-03-09 14:21 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-09 13:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2021-03-09
Priority|P3 |P2
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-2790-g5857042a2b3dd635fc6cae214abd60d3a8336060
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10/11 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
2021-03-02 7:32 ` [Bug c++/99318] " rguenth at gcc dot gnu.org
2021-03-09 13:49 ` jakub at gcc dot gnu.org
@ 2021-03-09 14:21 ` mpolacek at gcc dot gnu.org
2021-03-23 14:56 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-09 14:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10/11 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
` (2 preceding siblings ...)
2021-03-09 14:21 ` mpolacek at gcc dot gnu.org
@ 2021-03-23 14:56 ` cvs-commit at gcc dot gnu.org
2021-03-23 14:58 ` [Bug c++/99318] [10 " mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-23 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:831f9f768eb1fbf9a31d9a89591188b1487b6376
commit r11-7789-g831f9f768eb1fbf9a31d9a89591188b1487b6376
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Mar 9 19:23:48 2021 -0500
c++: Fix bogus warning in deprecated namespace [PR99318]
In GCC 10, I introduced cp_warn_deprecated_use_scopes so that we can
handle attribute deprecated on a namespace declaration. This
function walks the decl's contexts so that we warn for code like
namespace [[deprecated]] N { struct S { }; }
N::S s;
We call cp_warn_deprecated_use_scopes when we encounter a TYPE_DECL.
But in the following testcase we have a TYPE_DECL whose context is
a deprecated function; that itself is not a reason to warn. This
patch limits for which entities we call cp_warn_deprecated_use;
essentially it's what can follow ::.
I noticed that we didn't test that
struct [[deprecated]] S { static void fn(); };
S::fn();
produces the expected warning, so I've added gen-attrs-73.C.
gcc/cp/ChangeLog:
PR c++/99318
* decl2.c (cp_warn_deprecated_use_scopes): Only call
cp_warn_deprecated_use when decl is a namespace, class, or enum.
gcc/testsuite/ChangeLog:
PR c++/99318
* g++.dg/cpp0x/attributes-namespace6.C: New test.
* g++.dg/cpp0x/gen-attrs-73.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
` (3 preceding siblings ...)
2021-03-23 14:56 ` cvs-commit at gcc dot gnu.org
@ 2021-03-23 14:58 ` mpolacek at gcc dot gnu.org
2021-03-29 12:38 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-23 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11 Regression] |[10 Regression]
|-Wdeprecated-declarations |-Wdeprecated-declarations
|where non-should be? |where non-should be?
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
` (4 preceding siblings ...)
2021-03-23 14:58 ` [Bug c++/99318] [10 " mpolacek at gcc dot gnu.org
@ 2021-03-29 12:38 ` cvs-commit at gcc dot gnu.org
2021-03-29 12:38 ` rguenth at gcc dot gnu.org
2021-08-11 20:57 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-29 12:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:9879b82c77b0c65e39607a0a2d0891ebc75c5995
commit r10-9554-g9879b82c77b0c65e39607a0a2d0891ebc75c5995
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Mar 9 19:23:48 2021 -0500
c++: Fix bogus warning in deprecated namespace [PR99318]
In GCC 10, I introduced cp_warn_deprecated_use_scopes so that we can
handle attribute deprecated on a namespace declaration. This
function walks the decl's contexts so that we warn for code like
namespace [[deprecated]] N { struct S { }; }
N::S s;
We call cp_warn_deprecated_use_scopes when we encounter a TYPE_DECL.
But in the following testcase we have a TYPE_DECL whose context is
a deprecated function; that itself is not a reason to warn. This
patch limits for which entities we call cp_warn_deprecated_use;
essentially it's what can follow ::.
I noticed that we didn't test that
struct [[deprecated]] S { static void fn(); };
S::fn();
produces the expected warning, so I've added gen-attrs-73.C.
gcc/cp/ChangeLog:
PR c++/99318
* decl2.c (cp_warn_deprecated_use_scopes): Only call
cp_warn_deprecated_use when decl is a namespace, class, or enum.
gcc/testsuite/ChangeLog:
PR c++/99318
* g++.dg/cpp0x/attributes-namespace6.C: New test.
* g++.dg/cpp0x/gen-attrs-73.C: New test.
(cherry picked from commit 831f9f768eb1fbf9a31d9a89591188b1487b6376)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
` (5 preceding siblings ...)
2021-03-29 12:38 ` cvs-commit at gcc dot gnu.org
@ 2021-03-29 12:38 ` rguenth at gcc dot gnu.org
2021-08-11 20:57 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-29 12:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Known to fail| |10.2.0
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/99318] [10 Regression] -Wdeprecated-declarations where non-should be?
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
` (6 preceding siblings ...)
2021-03-29 12:38 ` rguenth at gcc dot gnu.org
@ 2021-08-11 20:57 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 20:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99318
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shyouhei@ruby-lang.org
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95302 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-11 20:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 14:48 [Bug c++/99318] New: [10/11 Regression] -Wdeprecated-declarations where non-should be? gcc-bugs at marehr dot dialup.fu-berlin.de
2021-03-02 7:32 ` [Bug c++/99318] " rguenth at gcc dot gnu.org
2021-03-09 13:49 ` jakub at gcc dot gnu.org
2021-03-09 14:21 ` mpolacek at gcc dot gnu.org
2021-03-23 14:56 ` cvs-commit at gcc dot gnu.org
2021-03-23 14:58 ` [Bug c++/99318] [10 " mpolacek at gcc dot gnu.org
2021-03-29 12:38 ` cvs-commit at gcc dot gnu.org
2021-03-29 12:38 ` rguenth at gcc dot gnu.org
2021-08-11 20:57 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).