Previously a key like:
"a\u0000\u0001b" = 1
Would get written with literal control characters, rather than escapes:
"a<00><01>b" = 1
The "valid/key/quoted-unicode" test from toml-test would fail with this,
although it seems they're not run automatically(?)
Can also reproduce with something like:
% cat test.cpp
#include <toml.hpp>
#include <iostream>
int main()
{
const auto data = toml::parse("test.toml");
std::cout << data << "\n";
return 0;
}
% cat test.toml
"a\u0000\u0001b" = "a\u0000\u0001b"
% c++ -I. test.cpp
% ./a.out
"ab" = "a\u0000\u0001b"
% ./a.out | hexdump -C
00000000 22 61 00 01 62 22 20 3d 20 22 61 5c 75 30 30 30 |"a..b" = "a\u000|
00000010 30 5c 75 30 30 30 31 62 22 0a 0a |0\u0001b"..|
We are using patched libc++ which uses raw pointers for vector itrators
to improve code compilation speed. This commit fixed two compilation
issues in toml11:
* location::const_iterator deinition assumes that vector const_iterator
is struct or class type rather than raw pointer.
* `const const_itetr foo()` triggers `-Wignored-qualifiers` for primitive
types and `void` which breaks `-Wextra -Werror` compilation.
When creating the inner iterator, make sure it points into the same
vector as the outer iterator. Otherwise, attempts to reset the iterator
wind up causing it to read out-of-bounds.
Fixes#199.
- fix error messages that referred to the wrong functions.
- parse_key(): remove "detail::" from the only error message that had
it, for consistency with the other error messages in that function
My recent patch had introduced a conditional use-after-move bug into the
test_parse_function_compiles function. This patch fixes that by
reworking the entire test case into a compile-time check. In my
opinion, we're not loosing anything by not actually executing the code
(the result wasn't looked at anyway) and the code becomes much clearer
by omitting the argument-preparation fluff.
The 'result' class has unwrap() and unwrap_err() member functions
overloaded for const lvalue and rvalue *this to avoid an unnecessarily
copying the to-be unwrapped object of its containing object is going to
be discarded anyway. Alas, the parse() function toml/parser.hpp file
stored the parse result in a local `const` variable so, although the
unwrap call would have been the last use of the object in each case, the
unnecessary copy would still be made. This patch removes the `const`
and adds a std::move() to actually benefit from the already implemented
optimization.