This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33793] New: global scoping for htons/htohs fails (::htons)
- From: "amit dot khandelwal at lehman dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2007 15:39:19 -0000
- Subject: [Bug c++/33793] New: global scoping for htons/htohs fails (::htons)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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