title: C++: ::ntohs() fails on higher optimization levels
body: <p>I have a <code>.cpp</code> file: <code>htonstest.cpp</code>. I use <code>g++</code> to compile it:</p>
  
  <pre><code>$ g++ -o test htonstest.cpp
  </code></pre>
  
  <p>It works, and the program <code>./test</code> works too. </p>
  
  <p>But, when I use automake to compile it, has a compile error:</p>
  
  <pre><code> htonstest.cpp: In function ‘int main()’: 
   htonstest.cpp:6: error：expected id-expression before ‘(’ token.
  </code></pre>
  
  <p>My OS is CentOS, gcc's version is 4.1.2 20080704, autoconf's version is 2.59, automake's version is 1.9.6.</p>
  
  <p>To reproduce:</p>
  
  <pre><code>$ aclocal
  $ autoheader
  $ autoconf
  $ automake -a
  $ ./configure
  $ make
  </code></pre>
  
  <p>ntohstest.cpp:</p>
  
  <pre><code> #include &lt;netinet/in.h&gt;
   #include &lt;iostream&gt;
  
   int main()
   {
       short a = ::ntohs(3);
       std::cout &lt;&lt; a &lt;&lt; std::endl;
       std::cin.get();
       return 0;
   }
  </code></pre>
  
  <p>configure.ac:</p>
  
  <pre><code> AC_PREREQ(2.59)
   AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
   AC_CONFIG_SRCDIR([htonstest.cpp])
   AC_CONFIG_HEADER([config.h])
   AM_INIT_AUTOMAKE([foreign])
   # Checks for programs.
   AC_PROG_CXX
  
   # Checks for libraries.
  
   # Checks for header files.
   # AC_CHECK_HEADERS([netinet/in.h])
  
   # Checks for typedefs, structures, and compiler characteristics.
  
   # Checks for library functions.
   AC_CONFIG_FILES(Makefile)
   AC_OUTPUT
  </code></pre>
  
  <p>Makefile.am:</p>
  
  <pre><code> bin_PROGRAMS=main
   main_SOURCES=htonstest.cpp
  </code></pre>