libpqxx3 tablereader doesn't compile with gcc 4.7 in C++11 mode

Bug #1189252 reported by Matt Amos
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libpqxx3 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

With the following packages installed, architecture i386, in Ubuntu 13.04:

libpqxx-3.1 3.1-1.1
libpqxx3-dev 3.1-1.1
g++-4.7 4.7.3-1ubuntu1

Downloading the libpqxx3 sources from http://packages.ubuntu.com/source/raring/libpqxx3 and attempting to compile test/test080.cxx with `g++ -o /dev/null -fpermissive -std=gnu++11 -c test080.cxx` gives the following errors below.

Note that the -fpermissive comes from a previous bug report which appears to be related (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672021) but apparently isn't a full fix in C++11 mode. Changes made in changeset 1834 of the upstream source appear to be related and possibly fix the problem (http://pqxx.org/development/libpqxx/changeset/1834/branches/3.1/include/pqxx/util.hxx).

I've separately compiled the upstream 3.1.1 release of libpqxx, and `make check` passes without compile errors.

--- Compile errors ---

/usr/include/pqxx/util.hxx:412:5: error: no matching function for call to ‘to_string(__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type)’
/usr/include/pqxx/util.hxx:412:5: note: candidates are:
In file included from /usr/include/c++/4.7/string:54:0,
                 from /usr/include/c++/4.7/bits/locale_classes.h:42,
                 from /usr/include/c++/4.7/bits/ios_base.h:43,
                 from /usr/include/c++/4.7/ios:43,
                 from /usr/include/c++/4.7/ostream:40,
                 from /usr/include/c++/4.7/iostream:40,
                 from test080.cxx:1:
/usr/include/c++/4.7/bits/basic_string.h:2915:3: note: std::string std::to_string(long double)
/usr/include/c++/4.7/bits/basic_string.h:2915:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘long double’
/usr/include/c++/4.7/bits/basic_string.h:2906:3: note: std::string std::to_string(double)
/usr/include/c++/4.7/bits/basic_string.h:2906:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘double’
/usr/include/c++/4.7/bits/basic_string.h:2897:3: note: std::string std::to_string(float)
/usr/include/c++/4.7/bits/basic_string.h:2897:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘float’
/usr/include/c++/4.7/bits/basic_string.h:2891:3: note: std::string std::to_string(long long unsigned int)
/usr/include/c++/4.7/bits/basic_string.h:2891:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘long long unsigned int’
/usr/include/c++/4.7/bits/basic_string.h:2885:3: note: std::string std::to_string(long long int)
/usr/include/c++/4.7/bits/basic_string.h:2885:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘long long int’
/usr/include/c++/4.7/bits/basic_string.h:2879:3: note: std::string std::to_string(long unsigned int)
/usr/include/c++/4.7/bits/basic_string.h:2879:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘long unsigned int’
/usr/include/c++/4.7/bits/basic_string.h:2874:3: note: std::string std::to_string(long int)
/usr/include/c++/4.7/bits/basic_string.h:2874:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘long int’
/usr/include/c++/4.7/bits/basic_string.h:2868:3: note: std::string std::to_string(unsigned int)
/usr/include/c++/4.7/bits/basic_string.h:2868:3: note: no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >::value_type {aka std::basic_string<char>}’ to ‘unsigned int’
...

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libpqxx3 (Ubuntu):
status: New → Confirmed
Revision history for this message
Nathan Kennedy (ntk) wrote :

I can confirm that this affects Saucy as well (gcc 4.8.1-10ubuntu9, libpqxx3-dev 3.1-1.1). This is causing similar errors compiling other libpqxx client software with gcc 4.7 and newer. -fpermissive does not resolve all errors.

The problem was indeed properly fixed upstream in revision 1834 and released in libpqxx 3.1.1 with no need for the -fpermissive workaround, but libpqxx3-dev 3.1-1.1 does not incorporate this fix and in particular the #include "pqxx/strconv" in /usr/include/pqxx/util.hxx

The libpqxx-dev version in Trusty (libpqxx3-dev_3.1.1-0ubuntu4) does have this fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.