Skip to content

Latest version 3.9.1 uses throw instead of JSON_THROW in the amalgamated json.hpp file #2934

Description

@xykivo

What is the issue you have?

In the 3.9.1 release, the amalgamated header (json.hpp), contains 2 throw statements

  • Line 16454
  • Line 16467

This causes compilation with the -fno-exceptions flag to fail.
Replacing these throw calls with JSON_THROW solves the issue.

I tried to fix the issue and create a pull request. However I couldn't find where these 2 lines are generated in the source code.

Please describe the steps to reproduce the issue.

  1. Include json.hpp in a C++ source file (simple main that includes the header, and create a json instance is enough)
  2. Compile the source file (using gcc or clang) with -fno-exceptions
    3 Compilation fails because of the throw statements
  3. Replace throw statements with JSON_THROW
  4. Compilation passes

Can you provide a small but working code example?

See above

What is the expected behavior?

Compiling with -fno-exceptions should pass

And what is the actual behavior instead?

Compilation with -fno-exceptions fails

Which compiler and operating system are you using?

  • Operating system: Ubuntu 20.04
  • Compiler: clang 10.0.0
  • Compiler: gcc 9.3.0

Which version of the library did you use?

3.9.1

  • [x ] latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

Did not check unit tests.

  • yes
  • no - please copy/paste the error message below

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugsolution: duplicatethe issue is a duplicate; refer to the linked issue insteadsolution: proposed fixa fix for the issue has been proposed and waits for confirmation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions