leveldb icon indicating copy to clipboard operation
leveldb copied to clipboard

require c++17 instead of c++11

Open bertsky opened this issue 10 months ago • 4 comments

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.

bertsky avatar Jan 27 '25 14:01 bertsky

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.

google-cla[bot] avatar Jan 27 '25 14:01 google-cla[bot]

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

littlemountainman avatar Jan 30 '25 10:01 littlemountainman

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

WHYBBE avatar Jul 18 '25 00:07 WHYBBE

It is better to make this compatible with C++11 by replacing the std::is_standard_layout_v part, as suggested in https://github.com/google/leveldb/pull/1251/commits/16c2b79d4d27a66b7e9da31117e01343e5b2d991.

acornmonkey avatar Aug 16 '25 03:08 acornmonkey