public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113755] New: Class without a viable destructor wrongly accepted
@ 2024-02-04 11:12 fchelnokov at gmail dot com
  2024-02-04 19:52 ` [Bug c++/113755] an implicit deconstructor is (incorrectly) added when the requires of the deconstructor fails pinskia at gcc dot gnu.org
  2024-02-04 19:53 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2024-02-04 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113755
           Summary: Class without a viable destructor wrongly accepted
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program

template <typename T>
struct A {
  ~A() requires(sizeof(T) < 2);
};

int main() {
    new A<int>;
}

is ill formed per
https://timsong-cpp.github.io/cppwp/n4868/class.dtor#4.sentence-2 and rejected
by both Clang and MSVC with the errors:

* no viable destructor found
* error C7653: failed to select a destructor for the class

but GCC accepts it: https://godbolt.org/z/bqcs8WY3P

Related discussion: https://stackoverflow.com/a/77928824/7325599

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

* [Bug c++/113755] an implicit deconstructor is (incorrectly) added when the requires of the deconstructor fails
  2024-02-04 11:12 [Bug c++/113755] New: Class without a viable destructor wrongly accepted fchelnokov at gmail dot com
@ 2024-02-04 19:52 ` pinskia at gcc dot gnu.org
  2024-02-04 19:53 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-04 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|Class without a viable      |an implicit deconstructor
                   |destructor wrongly accepted |is (incorrectly) added when
                   |                            |the requires of the
                   |                            |deconstructor fails
   Last reconfirmed|                            |2024-02-04
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/113755] an implicit deconstructor is (incorrectly) added when the requires of the deconstructor fails
  2024-02-04 11:12 [Bug c++/113755] New: Class without a viable destructor wrongly accepted fchelnokov at gmail dot com
  2024-02-04 19:52 ` [Bug c++/113755] an implicit deconstructor is (incorrectly) added when the requires of the deconstructor fails pinskia at gcc dot gnu.org
@ 2024-02-04 19:53 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-04 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I wonder if the wording changed between the time concepts was originally added
to GCC to the finalization of the C++20 standard; which would describe GCC's
behavior.

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

end of thread, other threads:[~2024-02-04 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-04 11:12 [Bug c++/113755] New: Class without a viable destructor wrongly accepted fchelnokov at gmail dot com
2024-02-04 19:52 ` [Bug c++/113755] an implicit deconstructor is (incorrectly) added when the requires of the deconstructor fails pinskia at gcc dot gnu.org
2024-02-04 19:53 ` 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).