public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33793]  New: global scoping for htons/htohs fails (::htons)
@ 2007-10-16 15:39 amit dot khandelwal at lehman dot com
  2007-10-16 15:46 ` [Bug c++/33793] " schwab at suse dot de
  0 siblings, 1 reply; 2+ messages in thread
From: amit dot khandelwal at lehman dot com @ 2007-10-16 15:39 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/33793] global scoping for htons/htohs fails (::htons)
  2007-10-16 15:39 [Bug c++/33793] New: global scoping for htons/htohs fails (::htons) amit dot khandelwal at lehman dot com
@ 2007-10-16 15:46 ` schwab at suse dot de
  0 siblings, 0 replies; 2+ messages in thread
From: schwab at suse dot de @ 2007-10-16 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2007-10-16 15:46 -------
htons is a macro, use parens or #undef to suppress it.


-- 

schwab at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33793


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-16 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-16 15:39 [Bug c++/33793] New: global scoping for htons/htohs fails (::htons) amit dot khandelwal at lehman dot com
2007-10-16 15:46 ` [Bug c++/33793] " schwab at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).