[Libpqxx-general] Error with gcc 4.3, was: pqxx::connection crash under libpqxx 2.6.9 and 3.0.0, OSX Leopard

Jeroen Vermeulen jtv at xs4all.nl
Fri Jul 18 08:33:32 UTC 2008


Roger Leigh wrote:

>>> Also note that using --enable-maintainer-mode also fails with GCC 4.3
>>> due to some of the -W options set in configure.ac not being valid for
>>> the new GCC.
>> configure.ac is supposed to test those for compatibility with the
>> compiler...  Which are the problem ones?
> 
> -Wno-long-double

Okay, I'll try removing that.  IIRC long double is a standard type, so 
compilers shouldn't warn about it anyway.  Leaving it out may break on 
very old gcc versions, but we'll see.


> With 3.0.0 in SVN:
> 
>  g++ -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/postgresql -g -O2 -Werror -Wno-long-double -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  -fPIC -DPIC -o .libs/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:382:   instantiated from here
> util.cxx:105: error: conversion to ‘short int’ from ‘int’ may alter its value

That's in absorb_digit():

template<typename L, typename R>
inline L absorb_digit(L value, R digit) throw ()
{
   return 10*value + L(digit);
}

I'm not too deep into the nitty-gritty of type theory anymore, but I 
suppose this comes from the "10*value".  Does the warning/error go away 
if you replace the 10 by L(10)?


Jeroen


More information about the Libpqxx-general mailing list