public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class
@ 2024-09-06 21:01 rs2740 at gmail dot com
  2024-09-06 21:27 ` [Bug c++/116636] [12/13/14/15 Regression] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rs2740 at gmail dot com @ 2024-09-06 21:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

            Bug ID: 116636
           Summary: Deprecation warning/unavailable error when overriding
                    member of virtual base class
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro:

struct B {
    virtual void f() = 0;
};
struct C : virtual B {
    [[deprecated("meow")]]
    void f() override {}
};

<source>:6:24: warning: 'virtual void C::f()' is deprecated: meow
[-Wdeprecated-declarations]
    6 |     void f() override {}
      |                        ^
<source>:6:10: note: declared here
    6 |     void f() override {}
      |          ^

Likewise:

struct B {
    virtual void f() = 0;
};
struct C : virtual B {
    [[gnu::unavailable("meow")]]
    void f() override {}
};

<source>:6:24: error: 'virtual void C::f()' is unavailable: meow
    6 |     void f() override {}
      |                        ^
<source>:6:10: note: declared here
    6 |     void f() override {}
      |          ^


Making the base class non-virtual makes the warning/error go away.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13/14/15 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
@ 2024-09-06 21:27 ` redi at gcc dot gnu.org
  2024-09-09  7:57 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2024-09-06 21:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
            Summary|Deprecation                 |[12/13/14/15 Regression]
                   |warning/unavailable error   |Deprecation
                   |when overriding member of   |warning/unavailable error
                   |virtual base class          |when overriding member of
                   |                            |virtual base class
                 CC|                            |jason at gcc dot gnu.org
      Known to work|                            |4.9.4
     Ever confirmed|0                           |1
      Known to fail|                            |5.1.0
   Last reconfirmed|                            |2024-09-06

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This has failed since r5-5027-g5f7282e2cb8e65
    re PR c++/33911 (attribute deprecated vs. templates)


struct B {
    virtual void f() = 0;
};
struct C : virtual B {
    __attribute__((deprecated))
    void f() {}
};

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13/14/15 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
  2024-09-06 21:27 ` [Bug c++/116636] [12/13/14/15 Regression] " redi at gcc dot gnu.org
@ 2024-09-09  7:57 ` rguenth at gcc dot gnu.org
  2024-09-11 11:19 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-09-09  7:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13/14/15 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
  2024-09-06 21:27 ` [Bug c++/116636] [12/13/14/15 Regression] " redi at gcc dot gnu.org
  2024-09-09  7:57 ` rguenth at gcc dot gnu.org
@ 2024-09-11 11:19 ` jakub at gcc dot gnu.org
  2024-09-12 16:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-09-11 11:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 59095
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59095&action=edit
gcc15-pr116636.patch

Untested fix.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13/14/15 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-09-11 11:19 ` jakub at gcc dot gnu.org
@ 2024-09-12 16:22 ` cvs-commit at gcc dot gnu.org
  2024-09-12 18:27 ` cvs-commit at gcc dot gnu.org
  2024-09-13 15:05 ` [Bug c++/116636] [12/13 " jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-09-12 16:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:4026d89d623e322920b052f7ac0d940ef267dc0f

commit r15-3610-g4026d89d623e322920b052f7ac0d940ef267dc0f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Sep 12 18:22:21 2024 +0200

    c++: Disable deprecated/unavailable diagnostics when creating thunks for
methods with such attributes [PR116636]

    On the following testcase, we emit false positive warnings/errors about
using
    the deprecated or unavailable methods when creating thunks for them, even
    when nothing (in the testcase so far) actually used those.

    The following patch temporarily disables that diagnostics when creating
    the thunks.

    2024-09-12  Jakub Jelinek  <jakub@redhat.com>

            PR c++/116636
            * method.cc: Include decl.h.
            (use_thunk): Temporarily change deprecated_state to
            UNAVAILABLE_DEPRECATED_SUPPRESS.

            * g++.dg/warn/deprecated-19.C: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13/14/15 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-09-12 16:22 ` cvs-commit at gcc dot gnu.org
@ 2024-09-12 18:27 ` cvs-commit at gcc dot gnu.org
  2024-09-13 15:05 ` [Bug c++/116636] [12/13 " jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-09-12 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5609246b561ab929b24eeb32965911884b58b0df

commit r14-10667-g5609246b561ab929b24eeb32965911884b58b0df
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Sep 12 18:22:21 2024 +0200

    c++: Disable deprecated/unavailable diagnostics when creating thunks for
methods with such attributes [PR116636]

    On the following testcase, we emit false positive warnings/errors about
using
    the deprecated or unavailable methods when creating thunks for them, even
    when nothing (in the testcase so far) actually used those.

    The following patch temporarily disables that diagnostics when creating
    the thunks.

    2024-09-12  Jakub Jelinek  <jakub@redhat.com>

            PR c++/116636
            * method.cc: Include decl.h.
            (use_thunk): Temporarily change deprecated_state to
            UNAVAILABLE_DEPRECATED_SUPPRESS.

            * g++.dg/warn/deprecated-19.C: New test.

    (cherry picked from commit 4026d89d623e322920b052f7ac0d940ef267dc0f)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/116636] [12/13 Regression] Deprecation warning/unavailable error when overriding member of virtual base class
  2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
                   ` (4 preceding siblings ...)
  2024-09-12 18:27 ` cvs-commit at gcc dot gnu.org
@ 2024-09-13 15:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-09-13 15:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116636

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13/14/15 Regression]    |[12/13 Regression]
                   |Deprecation                 |Deprecation
                   |warning/unavailable error   |warning/unavailable error
                   |when overriding member of   |when overriding member of
                   |virtual base class          |virtual base class

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 14.3+/15.1+.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-13 15:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-06 21:01 [Bug c++/116636] New: Deprecation warning/unavailable error when overriding member of virtual base class rs2740 at gmail dot com
2024-09-06 21:27 ` [Bug c++/116636] [12/13/14/15 Regression] " redi at gcc dot gnu.org
2024-09-09  7:57 ` rguenth at gcc dot gnu.org
2024-09-11 11:19 ` jakub at gcc dot gnu.org
2024-09-12 16:22 ` cvs-commit at gcc dot gnu.org
2024-09-12 18:27 ` cvs-commit at gcc dot gnu.org
2024-09-13 15:05 ` [Bug c++/116636] [12/13 " jakub 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).