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

            Bug ID: 117255
           Summary: There is a core language undefined behavior in the
                    constexpr function, but GCC did not report the error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qurong at ios dot ac.cn
  Target Milestone: ---

This causes an error in clang, but GCC didn't report the error. There is a core
language undefined behavior in the constexpr function:



```
struct A {
    constexpr ~A() {}
};

constexpr int foo() {
    A a;
    a.~A();
    return 0;
}

int main() {
    constexpr auto x = foo();
    return x;
}
```

Compiler Explorer link: https://godbolt.org/z/PMfv8G9ev

This code compiles an error with Clang and MSVC.

Reply via email to