Skip to content

Conversation

@eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Aug 11, 2025

Resolves CXX-3325.

The ""_bson user-defined literal (UDL) was introduced in #724. At the time, it was declared as (ignoring export macros):

document::value operator"" _bson(const char* str, size_t len);

#1066 attempted to reformat this declaration to address the -Wdeprecated-literal-operator warning observed with newer Clang compilers (per Compiler Explorer, supported since Clang 17 and enabled by default since Clang 20):

error: identifier '_bson' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
document::value operator""_bson(const char* json, size_t len);

but this had to be reverted by #1194 to restore compatibility with GCC 4.8 (which does not implement CWG 1473, prior to which a space between "" and ud-suffix was unfortunately mandatory; see this comment):

error: missing space between '""' and suffix identifier document::value operator""_bson(const char* json, size_t len);

However, following #1415, GCC 4.8 is no longer within our range of supported (minimum required) compilers. Therefore, we can now (re-)apply the proper fix (removing the space) without further issue.

Important

Following #1415, users on Red Hat 7 or older are expected to use a "Red Hat Developer Toolset" (DTS) or "GCC Toolset" to obtain a sufficiently recent GCC compiler version (GCC 8.1 or newer).

Note

There does not seem to be a ClangFormat option to control this behavior...?

@eramongodb eramongodb requested a review from kevinAlbs August 11, 2025 17:29
@eramongodb eramongodb self-assigned this Aug 11, 2025
@eramongodb eramongodb requested a review from a team as a code owner August 11, 2025 17:29
@eramongodb eramongodb merged commit 939c336 into mongodb:master Aug 11, 2025
20 of 22 checks passed
@eramongodb eramongodb deleted the cxx-3325 branch August 11, 2025 19:26
eramongodb added a commit to eramongodb/mongo-cxx-driver that referenced this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants