This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC -O error?
- From: hce <webmail dot hce at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 11 Nov 2008 14:53:54 +1100
- Subject: GCC -O error?
Hi,
I am using GCC version 4.3.0 on Linux FC 9. I found following a wired situation:
In a test.cpp there is a statement:
uint16_t so = ::htons(a); // line 168
It compiled fine if I use -g. But when I changed the -g to -O, it
broken to errors:
g++ -O -Wall -Wundef -Wabi -Wextra -Wunused -Wconversion -c -o
test.o test.cpp
test.cpp:168: error: expected id-expression before '(' token
test.cpp:168: warning: conversion to 'short unsigned int' from 'int'
may alter its value
Is it a bug, or what I am missing here?
Thank you.
Kind Regards,
Sean