I have this,
typedef struct {
union {
GLfloat v[3];
struct { GLfloat r,g,b;};
}; } vRGB;
but when it have this,
vRGB Returnrgb(…)
{ GLfloat vn[3]
//…here I calculate what vn values are.
return (vRGB) vn[0];
}
I get this:
zats.cpp(36) : error C2440: ‘type cast’ : cannot convert from ‘float’ to ‘vRGB’
No constructor could take the source type, or constructor overload resolution was ambiguous
WHY? Please help!
vRGB is = to float! I use union to access either as float or struct. So why no work? This is VC++ v6 compiler. Is it bug in compiler?
How to fix?