Fix an odr violation in ranges.h (#2483)

* Add a testcase demonstrating ODR violation in ranges.h

* Fix ODR violation in ranges.h

* Fix comments

Co-authored-by: Pierre-Antoine Lacaze <pa.lacaze@gmail.com>
This commit is contained in:
Pierre-Antoine Lacaze
2021-09-02 17:47:44 +02:00
committed by GitHub
parent ee0659f8b6
commit d58d19ba32
3 changed files with 21 additions and 2 deletions

View File

@@ -437,7 +437,7 @@ auto find_escape(const Char* begin, const Char* end)
return {begin, nullptr, 0};
}
auto find_escape(const char* begin, const char* end)
inline auto find_escape(const char* begin, const char* end)
-> find_escape_result<char> {
if (!is_utf8()) return find_escape<char>(begin, end);
auto result = find_escape_result<char>{end, nullptr, 0};