#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
class A
{
public:
std::string s;
A()
{
s = "string";
new(this)A(*this);
}
};
int main()
{
A a;
std::cout<<a.s;
return 0;
}
I get empty string in output. What does the C++ standard say about such behaviour?
There must be at least two problems here:
Not to mention that new(this)
is suspect in itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With