[ g++ issue ]
g++-4.4 / g++-4.5 doesn't detect following case, but, g++-4.6 does.
< a.cpp >
---------
class P {
public:
void a();
};
class A : public P {
public:
void p();
};
void
P::a() {
// 'const' quailifier' is discard here!
static_cast<const A*>(this)->p();
}
void
A::p() {
;
}
int
main() {
return 0;
}
=================== Test ======================
$ g++-4.5 a.cpp <= OK.
$ g++-4.6 a.cpp
a.cpp: In member function ‘void P::a()’:
a.cpp:13:33: error: passing ‘const A’ as ‘this’ argument of ‘void A::p()’ discards qualifiers [-fpermissive]
The problem is some of Android codes still have above bugs in its code - ex. frameworks/base/libs/utils/RefBase.cpp.
So, even if Android source code was successfully compiled at g++-4.4 or g++4.5, it may be failed at g++-4.6 (for example, upgrading host OS)
[ cc/gcc issue ]
Compiling with gcc-4.6 raises following warings.
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
In some component which uses '-Werror' option, this warning stops compilation.
[ Conclusion ]
So, you would better to use gcc/g++-4.4 instead of 4.6 when building Android, until above issues are resolved on Android baseline.
(ex. Ubuntu 11.10 as an Android host OS.)