check this out:
this compiles fine on iPhone:
typedef int ATYPE;
void AFunc()
{
ATYPE ATYPE;
ATYPE = 1337;
}
this compiles fine on iPhone:
typedef int ATYPE;
typedef ATYPE _ATYPE;
struct AStruct
{
_ATYPE ATYPE;
};
void AFunc()
{
AStruct bob;
bob.ATYPE = 1337;
}
but this does NOT:
typedef int ATYPE;
struct AStruct
{
ATYPE ATYPE;
};
void AFunc()
{
AStruct bob;
bob.ATYPE = 1337;
}
the above compiles fine on other platforms though.
I suppose we can work around it by doing that second example, but does anyone know why this is?
Well, if you don't like my previous answer, here's the alternate one. The online Comeau C++ compiler at http://www.comeaucomputing.com/tryitout/ compiles your third example without error. Given that that's typically considered a gold standard among C++ compilers, this suggests that this may well be a bug in the G++ compiler in the iPhone SDK (and, of course, in the other versions of G++ that I referenced in my comment).
If that's true -- and I don't have the C++ spec at hand to argue the fine details -- the answer to your "why?" question is, "Because G++ has a weird corner-case bug. Please file an issue in the GCC bug tracker about this, so that someone will fix it."