typedef type checking?

How do I get g++ to make type checks on typedefs? Is it possible? i.e.

typedef int T1;
typedef int T2;

T1 x = 5;     //Ok with me
T2 y = x;     //Any way to get an error or a warning here?

I can't use C++0x features (I don't know whether they can do this.)

EDIT: What I want is something like this:

typedef int BallID;
typedef int BatID;

BatID x = 10;
map<BatID, Bat*> m;
m.insert(make_pair(x, bigbat));        //OK
BallID y = 15;
m.insert(make_pair(y, smallbat));     //Give me a warning at least plz

Is this too much to ask?

7
задан Fred Foo 23 February 2011 в 18:15
поделиться