Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks
xykivo opened this issue Aug 14, 2021 · 2 comments · Fixed by #2347
Closed
4 tasks
Labels
kind: bug solution: duplicate the issue is a duplicate; refer to the linked issue instead solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@xykivo
Copy link

xykivo commented Aug 14, 2021

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
@nlohmann
Copy link
Owner

This has been fixed in the develop branch.

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Aug 15, 2021
@nlohmann nlohmann linked a pull request Aug 15, 2021 that will close this issue
@nlohmann
Copy link
Owner

Duplicate of #2725.

@nlohmann nlohmann added the solution: duplicate the issue is a duplicate; refer to the linked issue instead label Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug solution: duplicate the issue is a duplicate; refer to the linked issue instead solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants