[Libpqxx-general] Compile failure in current SVN

Jeroen Vermeulen jtv at xs4all.nl
Tue Aug 19 05:03:34 UTC 2008


Hi Roger!

Roger Leigh wrote:
> This still only occurs when --enable-maintainer-mode is in effect due to use
> of -Werror.  -Werror may be too strict, or one of the other -W options
> may be removed to prevent the diagnostic.

>  g++ -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/postgresql -g -O2 -Werror -Wno-div-by-zero -ffor-scope -fstrict-aliasing -Wstrict-aliasing -funit-at-a-time -pedantic -fno-nonansi-builtins -Wall -Wmultichar -W -Wextra -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wctor-dtor-privacy -Wendif-labels -Wlogical-op -Woverlength-strings -Wredundant-decls -Wsign-compare -Wwrite-strings -Wnon-virtual-dtor -Wreorder -Wold-style-cast -Woverloaded-virtual -Wsign-promo -Wstrict-null-sentinel -Wformat-security -Winit-self -Wswitch -Wmissing-field-initializers -Wmissing-include-dirs -Wunused -funit-at-a-time -Werror -MT util.lo -MD -MP -MF .deps/util.Tpo -c util.cxx -o util.o
> cc1plus: warnings being treated as errors
> util.cxx: In function ‘L<unnamed>::absorb_digit(L, R) [with L = short int, R = int]’:
> util.cxx:122:   instantiated from ‘void<unnamed>::from_string_signed(const char*, T&) [with T = short int]’
> util.cxx:391:   instantiated from here
> util.cxx:105: error: conversion to ‘short int’ from ‘int’ may alter its value
> util.cxx: In function ‘L<unnamed>::absorb_digit(L, R) [with L = short unsigned int, R = int]’:
> util.cxx:153:   instantiated from ‘void<unnamed>::from_string_unsigned(const char*, T&) [with T = short unsigned int]’
> util.cxx:403:   instantiated from here
> util.cxx:105: error: conversion to ‘short unsigned int’ from ‘int’ may alter its value

Hmmm... I thought I'd fixed this weeks ago.  I certainly can't reproduce 
it with g++ 4.2.3.

To confirm, in the code you're looking at, does it say exactly this?

return L(10)*value + L(digit);

We used to have a bug there where the 10 was left uncast, so for "short" 
types it promoted the entire expression to int.  The implicit conversion 
in returning the int as an unsigned short then triggered this warning on 
some gcc versions.


Jeroen


More information about the Libpqxx-general mailing list