public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111776] New: ICE on delete expression with multiple viable destroying operator delete
@ 2023-10-11 19:58 leni536 at gmail dot com
  2023-10-11 20:08 ` [Bug c++/111776] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: leni536 at gmail dot com @ 2023-10-11 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111776
           Summary: ICE on delete expression with multiple viable
                    destroying operator delete
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leni536 at gmail dot com
  Target Milestone: ---

version: gcc 13.2.0
flags: -std=c++20 -O2 -pedantic-errors

```
#include <memory>

struct B {
    void operator delete(B* ptr, std::destroying_delete_t);
};

struct D : B {
    void operator delete(D* ptr, std::destroying_delete_t);
    using B::operator delete;
};

void bar(D* ptr) {
    delete ptr;
}
```

internal compiler error: in build_op_delete_call, at cp/call.cc:7914
   13 |     delete ptr;
      |            ^~~
0x1ce7bde internal_error(char const*, ...)
        ???:0
0x7290fc fancy_abort(char const*, int, char const*)
        ???:0
0x7eb68c build_delete(unsigned int, tree_node*, tree_node*,
special_function_kind, int, int, int)
        ???:0
0x7d3757 delete_sanity(unsigned int, tree_node*, tree_node*, bool, int, int)
        ???:0
0x89fd5b c_parse_file()
        ???:0
0x98c5d9 c_common_parse_file()
        ???:0

https://godbolt.org/z/8rh7h7EWz

I'm not entirely sure what should actually happen here. I didn't find a
disambiguating rule at https://timsong-cpp.github.io/cppwp/n4868/expr.delete#10
.

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

* [Bug c++/111776] ICE on delete expression with multiple viable destroying operator delete
  2023-10-11 19:58 [Bug c++/111776] New: ICE on delete expression with multiple viable destroying operator delete leni536 at gmail dot com
@ 2023-10-11 20:08 ` mpolacek at gcc dot gnu.org
  2023-10-13  7:54 ` leni536 at gmail dot com
  2023-11-15 10:37 ` leni536 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-11 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2023-10-11
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  even g++9 ICEs.  g++8 gives errors.

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

* [Bug c++/111776] ICE on delete expression with multiple viable destroying operator delete
  2023-10-11 19:58 [Bug c++/111776] New: ICE on delete expression with multiple viable destroying operator delete leni536 at gmail dot com
  2023-10-11 20:08 ` [Bug c++/111776] " mpolacek at gcc dot gnu.org
@ 2023-10-13  7:54 ` leni536 at gmail dot com
  2023-11-15 10:37 ` leni536 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: leni536 at gmail dot com @ 2023-10-13  7:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Lénárd Szolnoki <leni536 at gmail dot com> ---
Same ICE without destroying delete:

```
struct A {
    void operator delete(void *);
};

struct B {
    void operator delete(void *);
};

struct C : A, B {
    using A::operator delete;
    using B::operator delete;
};

void f(C* ptr) {
    delete ptr;
}
```

This goes back to GCC 7.

GCC 6 accepts it and calls `A::operator delete`, which is not much better.

https://godbolt.org/z/cczfdKoqb

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

* [Bug c++/111776] ICE on delete expression with multiple viable destroying operator delete
  2023-10-11 19:58 [Bug c++/111776] New: ICE on delete expression with multiple viable destroying operator delete leni536 at gmail dot com
  2023-10-11 20:08 ` [Bug c++/111776] " mpolacek at gcc dot gnu.org
  2023-10-13  7:54 ` leni536 at gmail dot com
@ 2023-11-15 10:37 ` leni536 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: leni536 at gmail dot com @ 2023-11-15 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Lénárd Szolnoki <leni536 at gmail dot com> ---
The C++ standard currently doesn't specify what the behavior of these program
snippets are. This is CWG2805.

https://cplusplus.github.io/CWG/issues/2805.html

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

end of thread, other threads:[~2023-11-15 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 19:58 [Bug c++/111776] New: ICE on delete expression with multiple viable destroying operator delete leni536 at gmail dot com
2023-10-11 20:08 ` [Bug c++/111776] " mpolacek at gcc dot gnu.org
2023-10-13  7:54 ` leni536 at gmail dot com
2023-11-15 10:37 ` leni536 at gmail dot com

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).