taocpp / taopq

C++ client library for PostgreSQL
Boost Software License 1.0
265 stars 40 forks source link

akrzemi1/optional.hpp clashes with experimental/optional #4

Closed florath closed 7 years ago

florath commented 7 years ago

Hello Daniel,

it looks that the tao/postgres header clashes with experimental/optional.

// t.cc
#include <experimental/optional>
#include <tao/postgres.hpp>
int main() {}

using

g++ -std=c++14 -Itao/postgres/include t.cc

results in:

In file included from tao/postgres/include/tao/optional/optional.hpp:14:0,
             from tao/postgres/include/tao/postgres/result.hpp:19,
             from tao/postgres/include/tao/postgres/connection.hpp:12,
             from tao/postgres/include/tao/postgres.hpp:9,
             from t.cc:3:
tao/postgres/include/tao/optional/akrzemi1/optional.hpp:183:13: error: ‘optional’ is not a class template
   class optional< T& >;
         ^~~~~~~~

and a lot more....

The library itself compiles fine in this environment.

Using g++ 6.3.0 with libstdc++ 6.3 on Debian 9.1.

Any fix or workaround available?

d-frey commented 7 years ago

The detection of whether or not to use <experimental/optional> was broken, fixed now. Thanks for reporting this.

While this should solve your problem for now, you might also want to use a compiler that has <experimental/optional> or even the C++17-header <optional> but which we are currently not detecting properly. In that case please report a bug, but as a temporary work-around you can also define TAOCPP_USE_STD_OPTIONAL or TAOCPP_USE_TS_OPTIONAL before including any other header of our library, it will bypass the detection.