| Issue |
55523
|
| Summary |
Prospective destructors bug
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
SarkisKhachatryan
|
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs