public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100495] New: constexpr virtual destructor incorrectly reports memory leak
@ 2021-05-09 20:17 ldalessandro at gmail dot com
  2021-05-09 20:28 ` [Bug c++/100495] " ldalessandro at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ldalessandro at gmail dot com @ 2021-05-09 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100495
           Summary: constexpr virtual destructor incorrectly reports
                    memory leak
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

When using a constexpr virtual destructor gcc fails to match delete with
corresponding new.


```
struct Foo {
    constexpr virtual ~Foo() {}
};

constexpr bool foo() {
    Foo *ptr = new Foo();
    delete ptr;
    return true;
}

static_assert(foo()); //error: 'foo()' is not a constant expression because
allocated storage has not been deallocated
```


https://godbolt.org/z/W6haTEvzs

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

end of thread, other threads:[~2021-09-07 17:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09 20:17 [Bug c++/100495] New: constexpr virtual destructor incorrectly reports memory leak ldalessandro at gmail dot com
2021-05-09 20:28 ` [Bug c++/100495] " ldalessandro at gmail dot com
2021-05-09 21:28 ` ldalessandro at gmail dot com
2021-05-10 13:30 ` jakub at gcc dot gnu.org
2021-09-01 22:43 ` pinskia at gcc dot gnu.org
2021-09-06 10:31 ` jakub at gcc dot gnu.org
2021-09-06 11:48 ` jakub at gcc dot gnu.org
2021-09-07 17:35 ` cvs-commit at gcc dot gnu.org
2021-09-07 17:42 ` cvs-commit at gcc dot gnu.org
2021-09-07 17:44 ` 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).