Skip to content

Release build fails when JSON diagnostics enabled #5742

Description

@IvanPizhenko

Description

Release build fails when -DJSON_DIAGNOSTICS=1 -DJSON_DIAGNOSTIC_POSITIONS=1 are in effect.

Reproduction steps

Please see attached ZIP archive json_release_build_failure.zip with minimal reproducible example.
I'm using Ubuntu 24.04 LTS and GCC 13 (standard GCC version on that Ubuntu).

OS preparation:
Install C++ compiler and cmake, if you don't have them already:

sudo apt install -y build-essential cmake

Sample project is "standard" CMake based project.

  1. Unpack attached archive in the empty directory.
  2. Run commands to build in Release mode:
mkdir build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Release ..
make

This should fail.

Now edit CMakeLists.txt, comment out line where symbols -DJSON_DIAGNOSTICS=1 -DJSON_DIAGNOSTIC_POSITIONS=1 are added to the CMAKE_CXX_FLAGS.

Remove directory build-release and try steps above once again. Now it compiles and runs.

IMO diagnostics options must work in Release builds too.

Expected vs. actual results

Debug build compiles and runs as expected, no matter diagnostic options are in effect or not.
Release build fails to compile if diagnostic options are in effect.

Minimal code example

In attached ZIP archive.
json_release_build_failure.zip

Error messages

Too long to paste here. See attached file build.log.

Compiler and operating system

Ubuntu 24.04 LTS, GCC 13

Library version

633de8e

Validation

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

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions