[CXX-1296] Call to overloaded operator scoped_bson_t ambiguous Created: 06/Apr/17  Updated: 27/Oct/23  Resolved: 12/Apr/17

Status: Closed
Project: C++ Driver
Component/s: Portability
Affects Version/s: 3.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Amit Ambasta Assignee: Samuel Rossi (Inactive)
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Gentoo, gcc 6.3.0



 Description   

While trying to build mongo-cxx-driver as:

cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=yes -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=/usr -DBSONCXX_POLY_USE_MNMLSTC=no -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=1

the build fails with following errors:

/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/bulk_write.cpp: In member function ‘void mongocxx::v_noabi::bulk_write::append(const mongocxx::v_noabi::model::write&)’:
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/bulk_write.cpp:69:88: error: call of overloaded ‘scoped_bson_t(std::enable_if<true, bsoncxx::v_noabi::document::value>::type)’ is ambiguous
scoped_bson_t options(options_builder << bsoncxx::builder::stream::finalize);
^
In file included from /home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/bulk_write.cpp:21:0:
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/private/libbson.hh:68:5: note: candidate: mongocxx::v_noabi::libbson::scoped_bson_t::scoped_bson_t(std::experimental::fundamentals_v1::optional<bsoncxx::v_noabi::view_or_value<bsoncxx::v_noabi::document::view, bsoncxx::v_noabi::document::value> >)
scoped_bson_t(bsoncxx::stdx::optional<bsoncxx::document::view_or_value> doc);
^~~~~~~~~~~~~
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/private/libbson.hh:61:14: note: candidate: mongocxx::v_noabi::libbson::scoped_bson_t::scoped_bson_t(bsoncxx::v_noabi::document::view_or_value)
explicit scoped_bson_t(bsoncxx::document::view_or_value doc);
^~~~~~~~~~~~~
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/bulk_write.cpp:90:88: error: call of overloaded ‘scoped_bson_t(std::enable_if<true, bsoncxx::v_noabi::document::value>::type)’ is ambiguous
scoped_bson_t options(options_builder << bsoncxx::builder::stream::finalize);
^
In file included from /home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/bulk_write.cpp:21:0:
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/private/libbson.hh:68:5: note: candidate: mongocxx::v_noabi::libbson::scoped_bson_t::scoped_bson_t(std::experimental::fundamentals_v1::optional<bsoncxx::v_noabi::view_or_value<bsoncxx::v_noabi::document::view, bsoncxx::v_noabi::document::value> >)
scoped_bson_t(bsoncxx::stdx::optional<bsoncxx::document::view_or_value> doc);
^~~~~~~~~~~~~
/home/amitprakash/mongocxx/mongo-cxx-driver-r3.1.1/src/mongocxx/private/libbson.hh:61:14: note: candidate: mongocxx::v_noabi::libbson::scoped_bson_t::scoped_bson_t(bsoncxx::v_noabi::document::view_or_value)
explicit scoped_bson_t(bsoncxx::document::view_or_value doc);
etc



 Comments   
Comment by David Golden [ 12/Apr/17 ]

Hi, Amit. We may add C++17 support in the future and are tracking that in CXX-1306. We also have a CXX-1179 to explore vendoring mnmlstc to avoid the privileges needed during the build stage.

As you've got this building just fine with Boost, I'm going to close this ticket.

Comment by Amit Ambasta [ 07/Apr/17 ]

I was able to build it with boost just fine. Would C++17 support be formally added in a future release?

As for MNMLSTC Core, since the project tries to build and install it as a dependency, it runs into sandbox violations when PREFIX is specified.

Comment by Samuel Rossi (Inactive) [ 06/Apr/17 ]

Thanks for filing the ticket with us! Currently, the std::experimental polyfill does not work with the driver for GCC 6.x. While it does work with GCC 5.4, we still don't recommend using std::experimental. Using either MNMLSTC Core (our default polyfill on Linux) or Boost will should fine with either GCC 5 or 6 on Linux. Note that the driver vendors MNMLSTC Core, so you won't need to install any other dependencies to use it.

Generated at Wed Feb 07 22:02:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.