<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55523>55523</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Prospective destructors bug
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SarkisKhachatryan
      </td>
    </tr>
</table>

<pre>
    

I have this code and this outputs the following:

link to the following example https://godbolt.org/z/z8Pn9GsTv
```
template <typename T>
struct A1 {
    A1() {
        std::cout << "construction of a1" << std::endl;
    }
    ~A1() {
        std::cout << "destruction of a1" << std::endl;
    }
    ~A1() requires (std::is_same_v<T,int>) {
        std::cout << "it is an int" << std::endl;
    }
};

int main() {
    A1 <int>a;
    
    return 0;
}
```

output:
```
construction of a1
destruction of a1
```

but swapping places of destructors it gives other result:
link to the code https://godbolt.org/z/vxj7dPqaj
```
template <typename T>
struct A1 {
    A1() {
        std::cout << "construction of a1" << std::endl;
    }
    ~A1() requires (std::is_same_v<T,int>) {
        std::cout << "it is an int" << std::endl;
    }
    ~A1() {
        std::cout << "destruction of a1" << std::endl;
    }
};
```

output:
```
construction of a1
it is an int
```

The order should not change output of the program.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdVUtv3CAQ_jX4grrCEO_j4MMmm1ZVL5G69wjbszYJCw7g3aS_voO9L7eJqkiRWtXCmGGYb4bhG1PY6iUnbEXYcui_0kbugIZGeVraCqg01SDZLrRd8CgA3Vit7V6ZmojlpbVW5pEGO15D4VluWw20CaH10YJ_xlbbqrA6TKyrUfoR3_mdWXzx690BcsoOrRcDIIgMQIm4CS8tGLkFuibidlD74Loy0GVKyex6mKL4LFPC54QvxrPx8aGKsYhliTuLoNgo4by0ZsBS1lC7oRIR-FF_MgJTaSIuIMlsdSncvt9xBR_q18FTpxx4hJ6fzJW_95i3-x2Crgm_USbEDL4nTBUoskEaGm3fFWEcHBVDjxB0K5V5LVXxJMUhQDkGPI0chM4Zys6wJ19j8gz9QOEzZ8drXjn4fv73c3nbQ4Gp8nvZtpH3SNcS8482RwjrPMX81WoX57FKHG7Bd_oc02UF9fX3p6LZPT_Mqrsn-fBfFc2_R96_Vdajovk4Uo8S8Tb4GmloXYU89Y3tdEWNDbRspKnhcCFE0EjW1tnaye0kqXJRLcRCJkEFDfmds74F9I-3ymUZFF2ddE7nv_BbhaYrJqXdoqD17vj5hPAPiIKi8r4Dj4Msy7hImhxSkZaL2ZQVBYOM82yWTTdFlWbZBkBON4mWBWifk-waU29gT3sIHJNslaicM85Zls7YnHHBJvNpyuS83FwtUhCCF-SKAf6j9CTGEQsvcXkfEu7Ao1IrH_xZKb1XtQHo3SG-7EJjXf5dukflvzUSkxfcizRJH0Teb-InlSgZSA">