Why is it that this code (correctly, in my opinion) fails to compile:
Code:
struct Foo {
int value;
};
struct Bar {
int value;
};
Foo foo;
Bar bar = foo;
Yet this code compiles just fine.
Code:
template<typename T> struct Value {
T value;
};
typedef Value<int> Foo;
typedef Value<int> Bar;
Foo foo;
Bar bar = foo;
Is there anyway to get
struct typing behaviour with
templates? Why does C++ behave this way? If it helps, I'm using gcc 3.2.3
Thanks!