Skip to content

Conversation

@bertsky
Copy link

@bertsky bertsky commented Jan 27, 2025

Fixes the following build issue on GCC v9:

In file included from leveldb/util/comparator.cc:14:
leveldb/./util/no_destructor.h: In constructor ‘leveldb::NoDestructor<InstanceType>::NoDestructor(ConstructorArgTypes&& ...)’:
leveldb/./util/no_destructor.h:24:24: error: ‘is_standard_layout_v’ is not a member of ‘std’; did you mean ‘is_standard_layout’?
   24 |     static_assert(std::is_standard_layout_v<NoDestructor<InstanceType>>);
      |                        ^~~~~~~~~~~~~~~~~~~~
      |                        is_standard_layout
leveldb/./util/no_destructor.h:24:70: error: expected primary-expression before ‘>’ token
   24 |     static_assert(std::is_standard_layout_v<NoDestructor<InstanceType>>);
      |                                                                      ^~
leveldb/./util/no_destructor.h:24:72: error: expected primary-expression before ‘)’ token
   24 |     static_assert(std::is_standard_layout_v<NoDestructor<InstanceType>>);
      |                                                                        ^
make[2]: *** [CMakeFiles/leveldb.dir/build.make:468: CMakeFiles/leveldb.dir/util/comparator.cc.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:183: CMakeFiles/leveldb.dir/all] Fehler 2

This is a C++17 feature.

Note: I won't sign Google CLA.

@google-cla
Copy link

google-cla bot commented Jan 27, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@littlemountainman
Copy link

Since the google styleguide states "Currently, code should target C++20, i.e., should not use C++23 features" . Seems reasonable.

Had found the same regression as you in #1247

davidgumberg added a commit to davidgumberg/leveldb-subtree that referenced this pull request May 28, 2025
`std::is_standard_layout_v` (used in `util/no_destructor.h` is not
available until C++-17. This breaks building with some compilers.

Tested with clang 1f1c725b68b9d72b5cd3fc95c57ce4244bc85c8e (llvm/llvm-project@1f1c725)

google#1246
https://en.cppreference.com/w/cpp/types/is_standard_layout.html
davidgumberg added a commit to davidgumberg/leveldb-subtree that referenced this pull request Jun 11, 2025
`std::is_standard_layout_v` (used in `util/no_destructor.h`) is not
available until C++-17. This breaks building with some compilers.

Tested with clang 20.1.6.

google#1246
https://en.cppreference.com/w/cpp/types/is_standard_layout.html
@WHYBBE
Copy link

WHYBBE commented Jul 18, 2025

Is there anyone who can merge this request, or create a new PR? It's just a very minor fix.

@acornmonkey
Copy link

It is better to make this compatible with C++11 by replacing the std::is_standard_layout_v part, as suggested in 16c2b79.

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.

4 participants