[Bug c++/93668] New: constexpr delete[]

euloanty at live dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 11 03:05:00 GMT 2020


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

            Bug ID: 93668
           Summary: constexpr delete[]
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: euloanty at live dot com
  Target Milestone: ---

//This code should not compile because it is UB. delete a int[10000]

constexpr int f()
{
        auto p(new int[10000]);
        delete p;
        return 4;
}

int main()
{
        constexpr auto w(f());
}

//

constexpr int f()
{
        auto p(new int);
        delete[] p;
        return 4;
}

int main()
{
        constexpr auto w(f());
}


More information about the Gcc-bugs mailing list