From 01e05d89e9e15e37219ec40090b1e37f3ae75f90 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 23 Apr 2017 18:40:17 +0200 Subject: [PATCH] :hammer: fixed a compiler warning Default arguments are forbidden in lambdas. --- test/src/unit-unicode.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/src/unit-unicode.cpp b/test/src/unit-unicode.cpp index f2f2f83c..93df6808 100644 --- a/test/src/unit-unicode.cpp +++ b/test/src/unit-unicode.cpp @@ -34,6 +34,25 @@ using nlohmann::json; #include +std::string create_string(int byte1, int byte2 = -1, int byte3 = -1, int byte4 = -1) +{ + std::string result = "\"" + std::string(1, static_cast(byte1)); + if (byte2 != -1) + { + result += std::string(1, static_cast(byte2)); + } + if (byte3 != -1) + { + result += std::string(1, static_cast(byte3)); + } + if (byte4 != -1) + { + result += std::string(1, static_cast(byte4)); + } + result += "\""; + return result; +} + TEST_CASE("RFC 3629", "[hide]") { /* @@ -56,25 +75,6 @@ TEST_CASE("RFC 3629", "[hide]") UTF8-tail = %x80-BF */ - auto create_string = [](int byte1, int byte2 = -1, int byte3 = -1, int byte4 = -1) - { - std::string result = "\"" + std::string(1, static_cast(byte1)); - if (byte2 != -1) - { - result += std::string(1, static_cast(byte2)); - } - if (byte3 != -1) - { - result += std::string(1, static_cast(byte3)); - } - if (byte4 != -1) - { - result += std::string(1, static_cast(byte4)); - } - result += "\""; - return result; - }; - SECTION("ill-formed first byte") { for (int byte1 = 0x80; byte1 <= 0xC1; ++byte1)