public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice
@ 2023-09-15 13:38 mpolacek at gcc dot gnu.org
  2023-09-15 13:39 ` [Bug c++/111426] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-09-15 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111426
           Summary: [11/12/13/14 Regression] "error: use of deleted
                    function" printed twice
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

An inaccessible destructor prevents derivation:

struct X {
  ~X() = delete;
};

class D : public X { };
D d;

but we complain twice:

$ ./cc1plus -quiet q.C
q.C:6:3: error: use of deleted function ‘D::D()’
    6 | D d;
      |   ^
q.C:5:7: note: ‘D::D()’ is implicitly deleted because the default definition
would be ill-formed:
    5 | class D : public X { };
      |       ^
q.C:5:7: error: use of deleted function ‘X::~X()’
q.C:2:3: note: declared here
    2 |   ~X() = delete;
      |   ^
q.C:6:3: error: use of deleted function ‘D::~D()’
    6 | D d;
      |   ^
q.C:5:7: note: ‘D::~D()’ is implicitly deleted because the default definition
would be ill-formed:
    5 | class D : public X { };
      |       ^
q.C:5:7: error: use of deleted function ‘X::~X()’
q.C:2:3: note: declared here
    2 |   ~X() = delete;
      |   ^

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

* [Bug c++/111426] [11/12/13/14 Regression] "error: use of deleted function" printed twice
  2023-09-15 13:38 [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice mpolacek at gcc dot gnu.org
@ 2023-09-15 13:39 ` mpolacek at gcc dot gnu.org
  2024-03-07 22:29 ` law at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-09-15 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5
           Keywords|                            |diagnostic
                 CC|                            |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-09-15
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=106880

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r224842 so it's not a dup of bug 106880.

commit d4c9e7f92225d829ad1d18c950066cf99fc58cc7
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 23 10:08:19 2015 -0400

    re PR c++/66542 ([C++11] Can create static variable of type that has
deleted destructor)

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

* [Bug c++/111426] [11/12/13/14 Regression] "error: use of deleted function" printed twice
  2023-09-15 13:38 [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice mpolacek at gcc dot gnu.org
  2023-09-15 13:39 ` [Bug c++/111426] " mpolacek at gcc dot gnu.org
@ 2024-03-07 22:29 ` law at gcc dot gnu.org
  2024-03-27 15:05 ` jakub at gcc dot gnu.org
  2024-03-27 15:47 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

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

* [Bug c++/111426] [11/12/13/14 Regression] "error: use of deleted function" printed twice
  2023-09-15 13:38 [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice mpolacek at gcc dot gnu.org
  2023-09-15 13:39 ` [Bug c++/111426] " mpolacek at gcc dot gnu.org
  2024-03-07 22:29 ` law at gcc dot gnu.org
@ 2024-03-27 15:05 ` jakub at gcc dot gnu.org
  2024-03-27 15:47 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-27 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
These are two different diagnostics.
One error is about using deleted D::D() and explains why it is deleted, the
other is about using deleted D::~D() and explains why it is deleted.
Do you mean we shouldn't diagnose using deleted D::~D() when we already
diagnosed some other special member (D::D() in that case)?

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

* [Bug c++/111426] [11/12/13/14 Regression] "error: use of deleted function" printed twice
  2023-09-15 13:38 [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-27 15:05 ` jakub at gcc dot gnu.org
@ 2024-03-27 15:47 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-27 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I meant that g++5 emitted

111426.C:7:3: error: use of deleted function ‘D::D()’
 D d;
   ^
111426.C:6:7: note: ‘D::D()’ is implicitly deleted because the default
definition would be ill-formed:
 class D : public X { };
       ^
111426.C:6:7: error: use of deleted function ‘X::~X()’
111426.C:3:3: note: declared here
   ~X() = delete;
   ^

which seems more user-friendly than 4 errors, and saying that X::~X() is
deleted twice.  clang++ emits only one error.

But, maybe it's not that bad after all.  Feel free to close this.

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

end of thread, other threads:[~2024-03-27 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 13:38 [Bug c++/111426] New: [11/12/13/14 Regression] "error: use of deleted function" printed twice mpolacek at gcc dot gnu.org
2023-09-15 13:39 ` [Bug c++/111426] " mpolacek at gcc dot gnu.org
2024-03-07 22:29 ` law at gcc dot gnu.org
2024-03-27 15:05 ` jakub at gcc dot gnu.org
2024-03-27 15:47 ` mpolacek 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).