/*
mm.cpp
*/
#include
using namespace std;
struct xx{
int x;
int mm()const;
int mm();
};
int xx::mm() const
{
return const_cast<xx*>(this)->mm();
}
int xx::mm()
{
cout<<“ok”<<endl;
return x;
}
int main()
{
xx x;
x.mm();
return 0;
}
/*********************************************************************************************************************/
[ws@localhost dev]$ llvm-c++ --emit-llvm mm.cpp
In file included from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/cstring:52,
from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/i686-pc-linux-gnu/bits/c++locale.h:47,
from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/iosfwd:45,
from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/ios:43,
from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/ostream:45,
from /home/ws/software/llvm-gcc4.2-2.5-x86-linux-RHEL4/bin/…/lib/gcc/i686-pc-linux-gnu/4.2.1/…/…/…/…/include/c++/4.2.1/iostream:45,
from mm.cpp:1:
/usr/include/string.h:546: error: ‘__locale_t’ has not been declared
/usr/include/string.h:547: error: nonnull argument references non-pointer operand (argument 1, operand 3)
/usr/include/string.h:550: error: ‘__locale_t’ has not been declared
/usr/include/string.h:551: error: nonnull argument references non-pointer operand (argument 1, operand 4)
In my system , gcc-3.4.6 is used as default gcc tool;
thanks.