NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
84 stars 63 forks source link

network::Network has an ambiguous constructor call #782

Closed program-- closed 7 months ago

program-- commented 7 months ago

I'm not sure how this wasn't an issue previously, but it came up while refactoring some of the CMake code (I'm guessing a unity build gave visibility to the nullptr default). This should also pop up for the normal HY_Features class.

src/core/HY_Features_MPI.cpp:9:7: error: call to constructor of 'network::Network' is ambiguous
    9 |       network(linked_hydro_fabric), formulations(formulations), mpi_rank(mpi_rank), mpi_num_procs(mpi_num_procs)
      |       ^       ~~~~~~~~~~~~~~~~~~~
src/core/network.cpp:28:10: note: candidate constructor
   28 | Network::Network( geojson::GeoJSON fabric ){
      |          ^
src/core/network.cpp:103:10: note: candidate constructor
  103 | Network::Network( geojson::GeoJSON features, std::string* link_key = nullptr ){
      |          ^
1 error generated.
Constructor Declarations https://github.com/NOAA-OWP/ngen/blob/a788ca4aa892304bcf0d6c0c28b665a6e35e466e/include/core/network.hpp#L154-L167
Network::Network(geojson::GeoJSON fabric) Definition https://github.com/NOAA-OWP/ngen/blob/a788ca4aa892304bcf0d6c0c28b665a6e35e466e/src/core/network.cpp#L28-L81
Network::Network(geojson::GeoJSON features, std::string* link_key = nullptr) Definition https://github.com/NOAA-OWP/ngen/blob/a788ca4aa892304bcf0d6c0c28b665a6e35e466e/src/core/network.cpp#L103-L140

The easy solution to this is to remove the default for link_key I think, though I don't immediately know of any consequences of that.