K
Kalle Rutanen
Hello.
The following code compiles fine with VC7. I seemingly call int's
destructor. Why does it compile ? What does the standard say about this
?
#include <new>
using namespace std;
template <typename T>
void destruct(T* that)
{
that->~T();
}
int main()
{
char memory[100];
int* a = 0;
// Can do this...
a = new(memory) int;
destruct(a);
// But can't do this
a = new(memory) int;
//a->~int();
return 0;
}
The following code compiles fine with VC7. I seemingly call int's
destructor. Why does it compile ? What does the standard say about this
?
#include <new>
using namespace std;
template <typename T>
void destruct(T* that)
{
that->~T();
}
int main()
{
char memory[100];
int* a = 0;
// Can do this...
a = new(memory) int;
destruct(a);
// But can't do this
a = new(memory) int;
//a->~int();
return 0;
}