fixed toml::literals namespace ambiguity (closes #69)

This commit is contained in:
Mark Gillard 2020-10-22 16:25:26 +03:00
parent 5f3e01f71c
commit 44c7da27d6
5 changed files with 29 additions and 8 deletions

View File

@ -204,6 +204,7 @@ UTF-8 decoding is performed using a state machine based on Bjoern Hoehrmann's '[
- **[@shdnx](https://github.com/shdnx)** - Fixed a bug on GCC 8.2.0 and some meson config issues - **[@shdnx](https://github.com/shdnx)** - Fixed a bug on GCC 8.2.0 and some meson config issues
- **[@sobczyk](https://github.com/sobczyk)** - Reported some bugs - **[@sobczyk](https://github.com/sobczyk)** - Reported some bugs
- **[@sneves](https://github.com/sneves)** - Helped fix a number of parser bugs - **[@sneves](https://github.com/sneves)** - Helped fix a number of parser bugs
- **[@std-any-emplace](https://github.com/std-any-emplace)** - Reported some bugs
- **[@traversaro](https://github.com/traversaro)** - Added vcpkg support and reported a bunch of bugs - **[@traversaro](https://github.com/traversaro)** - Added vcpkg support and reported a bunch of bugs
- **[@ximion](https://github.com/ximion)** - Added support for installation with meson - **[@ximion](https://github.com/ximion)** - Added support for installation with meson
- **[@whiterabbit963](https://github.com/whiterabbit963)** - Fixed a bug with value_or conversions - **[@whiterabbit963](https://github.com/whiterabbit963)** - Fixed a bug with value_or conversions

View File

@ -733,8 +733,12 @@ TOML_NAMESPACE_START
return parse_file(std::basic_string_view<Char>{ file_path }); return parse_file(std::basic_string_view<Char>{ file_path });
} }
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals inline namespace literals
{ {
TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, lit_ex, lit_noex)
/// \brief Parses TOML data from a string literal. /// \brief Parses TOML data from a string literal.
/// ///
/// \detail \cpp /// \detail \cpp
@ -785,10 +789,9 @@ TOML_NAMESPACE_START
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
}
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
} }
}
TOML_NAMESPACE_END TOML_NAMESPACE_END
#undef TOML_THROW_PARSE_ERROR #undef TOML_THROW_PARSE_ERROR

View File

@ -3085,8 +3085,12 @@ TOML_NAMESPACE_START
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals inline namespace literals
{ {
TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, lit_ex, lit_noex)
TOML_API TOML_API
TOML_EXTERNAL_LINKAGE TOML_EXTERNAL_LINKAGE
parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW
@ -3104,10 +3108,10 @@ TOML_NAMESPACE_START
} }
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
}
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
} }
}
TOML_NAMESPACE_END TOML_NAMESPACE_END
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS

View File

@ -136,5 +136,11 @@ TEST_CASE("user feedback")
CHECK(ss.str() == "array = [ 'v1', 'v2', 'v3' ]"sv); CHECK(ss.str() == "array = [ 'v1', 'v2', 'v3' ]"sv);
}); });
} }
SECTION("github/issues/69") // https://github.com/marzer/tomlplusplus/issues/69
{
using namespace toml::literals; // should compile without namespace ambiguity
auto table = "[table]\nkey=\"value\""_toml;
}
} }

View File

@ -7515,8 +7515,12 @@ TOML_NAMESPACE_START
return parse_file(std::basic_string_view<Char>{ file_path }); return parse_file(std::basic_string_view<Char>{ file_path });
} }
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals inline namespace literals
{ {
TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, lit_ex, lit_noex)
[[nodiscard]] [[nodiscard]]
TOML_API TOML_API
parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW; parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW;
@ -7529,10 +7533,9 @@ TOML_NAMESPACE_START
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
}
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
} }
}
TOML_NAMESPACE_END TOML_NAMESPACE_END
#undef TOML_THROW_PARSE_ERROR #undef TOML_THROW_PARSE_ERROR
@ -11806,8 +11809,12 @@ TOML_NAMESPACE_START
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals inline namespace literals
{ {
TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, lit_ex, lit_noex)
TOML_API TOML_API
TOML_EXTERNAL_LINKAGE TOML_EXTERNAL_LINKAGE
parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW parse_result operator"" _toml(const char* str, size_t len) TOML_MAY_THROW
@ -11825,10 +11832,10 @@ TOML_NAMESPACE_START
} }
#endif // __cpp_lib_char8_t #endif // __cpp_lib_char8_t
}
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
} }
}
TOML_NAMESPACE_END TOML_NAMESPACE_END
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS