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

Reply via email to