OS: CentOS 5.0 x86_64
or Debian Sid (i386)
gcc (GCC) 4.1.3 20070718 (prerelease) (Debian 4.1.2-14)
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
Test Code (test.cpp) :
=============CODE STARTS HERE================
int main(int argc, char** argv)
std::string abc = "hello world";
buffer >> str2;
=============CODE ENDS HERE================
/usr/bin/gcc -o test test.cpp -lstdc++ -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -O0 -g -D_GLIBCXX_DEBUG
Can you try a later version of GCC as 4.1.x's libstdc++ did not have the fix for -fvisibility=hidden, see PR 19664 for more details (it was fixed for 4.2.0).
I have tried the code and it works for gcc 4.2.
But I have to sticked at gcc 4.1.x for compatibility reason
I was about to reply the same as Andrew's... Mainline is also ok, by the way. I'm afraid this will end up being a WONTFIX in 4_1-branch because there are zero chances that those fixes will be backported to the branch...