google / google/filament

The assert_variant macro clashes with other libraries

Open
#8,769 7 comments 1 reaction 1 assignee Claimed by @pixelflinger View on GitHub
Dominant language
C++
Stars
20.5k
Forks
2.3k
Avg merge
2d 16h
Merged PRs (30d)
74

Description

**Describe the bug**

When using Filament in a project that also uses the commonly used [nlohmannJSON library](https://github.com/nlohmann/json), Filament's [assert_invariant macro](https://github.com/google/filament/blob/1305303f2ee730775f3ce964ce544c8735357c37/libs/utils/include/utils/debug.h#L27) conflicts with nlohmann's [assert_invariant function](https://github.com/nlohmann/json/blob/4b17f90f65be4ba980faa0bc1dee8745cf0d6028/include/nlohmann/json.hpp#L686).

**To Reproduce**

Steps to reproduce the behavior:
1. Integrate nlohmann into a project using Filament
2. Include nlohmann's headers

This causes the compilation to fail.

**Expected behavior**

Filament should not clash with other libraries because of global identifiers.
The macro could be prefixed or converted to a scoped function.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.