is this a bug in VS 2013 compiler?
The following code produces different result in debug and release.
In debug the result is as expected, but in release it is "A"
#include <cstdio>
struct A
{
virtual void* getClass() { return A::ID; };
static void ID(){};
};
struct B : public A
{
virtual void* getClass() { return B::ID; };
static void ID(){};
};
struct C : public A
{
virtual void* getClass() { return C::ID; };
static void ID(){};
};
int main(int argc, char *argv[])
{
A* d = new C;
if (d->getClass() == A::ID)
{
printf("A");
}
else if (d->getClass() == B::ID)
{
printf("B");
}
else if (d->getClass() == C::ID)
{
printf("C");
}
}