M
Marco Jez
I think I have found a bug in the Visual C++ compiler (version 7.1). What is
the preferred way for reporting it to Microsoft? Here's a brief description
of the suspect behavior: the expression typeid(A)==typeid(B) evaluates to
true when A and B are instances of two different unnamed classes, even
though it should evaluate to false. This only happens when A and B are
defined at namespace scope. Example:
#include <typeinfo>
#include <iostream>
class { int x; } A;
class { double x; } B;
int main()
{
std::cout << (typeid(A) == typeid(B)) << std::endl;
return 0;
}
The above code prints "1" to stdout while it should print "0" instead
because A and B are instances of two different types.
Cheers,
Marco
the preferred way for reporting it to Microsoft? Here's a brief description
of the suspect behavior: the expression typeid(A)==typeid(B) evaluates to
true when A and B are instances of two different unnamed classes, even
though it should evaluate to false. This only happens when A and B are
defined at namespace scope. Example:
#include <typeinfo>
#include <iostream>
class { int x; } A;
class { double x; } B;
int main()
{
std::cout << (typeid(A) == typeid(B)) << std::endl;
return 0;
}
The above code prints "1" to stdout while it should print "0" instead
because A and B are instances of two different types.
Cheers,
Marco