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

            Bug ID: 104055
           Summary: Temporary with conteval constructor is ignored
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Execution of the following program
```
#include <iostream>

int g = 0;

struct A { 
    ~A() { g = 1; }
    consteval A() {}
};

int main() {
    A{};
    std::cout << g;
}
```
prints `0` in GCC. Demo: https://gcc.godbolt.org/z/7xxn67WbM

This means that the destructor of the temporary (which sets g=1) is not called.

Reply via email to