Skip to content

Commit

Permalink
gcc_maybe_uninitialized_t test (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenberry authored Jan 13, 2025
1 parent 9756ea1 commit b2a465f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/jmespath/jmespath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,30 @@ suite jmespath_slice_tests = [] {
};
};

// A test case for a GCC14 warning
struct gcc_maybe_uninitialized_t
{
int acc{};
int abbb{};
int cqqq{};
};

struct test_wrapper_t
{
gcc_maybe_uninitialized_t test{};
};

suite gcc_maybe_uninitialized_tests = [] {
"gcc_maybe_uninitialized"_test = [] {
using namespace std::string_view_literals;

gcc_maybe_uninitialized_t log{};

constexpr glz::opts opts{.null_terminated=0, .error_on_unknown_keys = 0};
auto ec = glz::read_jmespath<"test", opts>(log, R"({"test":{"acc":1}})"sv);
expect(not ec) << glz::format_error(ec, R"({"test":{"acc":1}})"sv);
expect(log.acc == 1);
};
};

int main() { return 0; }

0 comments on commit b2a465f

Please sign in to comment.