GCC version: 3.2.3 Host: Linux Sample code.
#include <netinet/in.h> int main() { unsigned short t; ::htons(t); return 0; } /usr/bin/g++ -O2 t.cpp t.cpp: In function `int main()': t.cpp:10: syntax error before `__extension__' t.cpp:10: `__x' undeclared (first use this function) t.cpp:10: (Each undeclared identifier is reported only once for each function it appears in.) t.cpp:10: `__v' undeclared (first use this function) t.cpp: At global scope: t.cpp:10: syntax error before `)' token If I don't use -O2 the code compiles. If I change ::htons to htons the code compiles even with -O2. Why does it fail for ::htons() -- Summary: global scoping for htons/htohs fails (::htons) Product: gcc Version: 3.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amit dot khandelwal at lehman dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33793