Skip to content

Fix duplicate symbols for functions in cpp2util.h #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/cpp2util.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class contract_group {
handler reporter;
};

[[noreturn]] auto report_and_terminate(std::string_view group, CPP2_MESSAGE_PARAM msg = "" CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) noexcept -> void {
[[noreturn]] inline auto report_and_terminate(std::string_view group, CPP2_MESSAGE_PARAM msg = "" CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT) noexcept -> void {
std::cerr
#ifdef CPP2_USE_SOURCE_LOCATION
<< where.file_name() << "("
Expand Down Expand Up @@ -734,26 +734,26 @@ template <class F>
//-----------------------------------------------------------------------
//
template<typename T>
auto to_string(T const& t) -> std::string
inline auto to_string(T const& t) -> std::string
requires requires { std::to_string(t); }
{
return std::to_string(t);
}

auto to_string(std::string const& s) -> std::string const&
inline auto to_string(std::string const& s) -> std::string const&
{
return s;
}

template<typename T>
auto to_string(std::optional<T> const& o) -> std::string {
inline auto to_string(std::optional<T> const& o) -> std::string {
if (o.has_value()) {
return std::to_string(o.value());
}
return "(empty)";
}

auto to_string(...) -> std::string {
inline auto to_string(...) -> std::string {
return "(customize me - no cpp2::to_string overload exists for this type)";
}

Expand Down Expand Up @@ -792,7 +792,7 @@ class c_raii {
auto operator=(c_raii&& that) { t = std::move(that.t); dtor = that.dtor; that.dtor = nullptr; }
};

auto fopen( const char* filename, const char* mode ) {
inline auto fopen( const char* filename, const char* mode ) {
auto x = std::fopen(filename, mode);
if (!x) {
throw std::make_error_condition(std::errc::no_such_file_or_directory);
Expand Down