Comments (7)
The example code provided contains syntax errors. Sure, I could try to fix them, but then I would just be guessing what your code actually says and possibly hiding the error. Please provide a working reproduction.
from abseil-cpp.
The example code provided contains syntax errors. Sure, I could try to fix them, but then I would just be guessing what your code actually says and possibly hiding the error. Please provide a working reproduction.
const StringViewMap& replacements() const {
remove second const should work, sorry i try to have a minimal viable test but didn't compile again
I modify the initial STR too
from abseil-cpp.
I will not look at this until I have a complete reproduction.
from abseil-cpp.
I'll try to have a unit test
from abseil-cpp.
it's reproducible in my macOS from this commit
JuniorHsu@432bd53
~/code/abseil-cpp $ bazel test --sandbox_debug -c dbg --test_output=streamed --verbose_failures --cxxopt=-std=c++20 absl/container:flat_hash_map_test --test_filter=FlatHashMap.EmptyStringViewMap
WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time
INFO: Analyzed target //absl/container:flat_hash_map_test (0 packages loaded, 3 targets configured).
Running main() from gmock_main.cc
Note: Google Test filter = FlatHashMap.EmptyStringViewMap
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from FlatHashMap
[ RUN ] FlatHashMap.EmptyStringViewMap
absl/container/flat_hash_map_test.cc:91: Failure
Expected equality of these values:
r.size()
Which is: 1
2
[ FAILED ] FlatHashMap.EmptyStringViewMap (0 ms)
[----------] 1 test from FlatHashMap (0 ms total)
from abseil-cpp.
Thank you for the reproduction.
This isn't an absl::flat_hash_map
issue. std::unordered_map
demonstrates the same behavior.
If you replace new type{__VA_ARGS__}
with new type(__VA_ARGS__)
in CONSTRUCT_ON_FIRST_USE
then it will work, but I don't think you want to do that, because it will change the meaning of other code.
Basically this is a more complicated form of
std::vector<int> v(5, 0); // Vector v holds 5 zeros -> {0, 0, 0, 0, 0}
std::vector<int> v{5, 0}; // Vector v holds a 5 and a 0 -> {5, 0}
C++20 added a new string_view constructor which is why you are seeing this issue in C++20 only. A different constructor is getting called.
My only advice is not to use CONSTRUCT_ON_FIRST_USE
at all. absl::NoDestructor
might be helpful here.
See also https://abseil.io/tips/88.
from abseil-cpp.
Thanks for digging on this. I filed envoyproxy/envoy#33804
Could be a design defect on c++ 20 if we could reproduce in std::unordered_map
from abseil-cpp.
Related Issues (20)
- [Bug]: Uninitialized value in AnyInvocable.
- [Bug]: Build failure MSVC x86 with /arch:AVX2 HOT 4
- [Bug]: ABSL_ATTRIBUTE_NORETURN doesn't work in all contexts HOT 1
- [Bug]: Compilation issue on Windows 2022 with Ninja and CMake
- [Bug]: Can't link using riscv64 toolchain
- use vcpkg install absl dll lib link error HOT 1
- [Bug]: Sanitizer options may disagree between library and user leading to ODR violations
- Can't link to MSVC built abseil with clang/LLVM
- improvement : keep cmakelists clean, remove unneeded policy activations that are already active HOT 2
- [Bug]: container test_allocator should be skipped if testing is disabled HOT 4
- [Bug]: Build error during cmake quick start HOT 1
- [Bug]: 20240722.rc1 can not be built for android ndk r25b / r25c HOT 3
- [Bug]: Can't build C++20 project without .bazelrc HOT 2
- [Bug]: absl::Log Initialization in DLL Fails When Called Using ctypes on Windows
- [Bug]: Flag "-Wnon-virtual-dtor" is added to pkg-config files
- [Bug]: error while loading shared libraries: libabsl_cord_internal.so.2401.0.0: cannot open shared object file: No such file or directory
- [Bug]: asan failure in absl::Status::ToString() HOT 3
- [Bug]: Compilation regression in version update: "...incomplete type 'absl::container_internal::HashEq..." HOT 2
- Have Bazel rules for creating shared libraries HOT 2
- [Bug]: Undefined symbol referenced from absl::lts_20240722::log_internal::LogMessage::operator<<(unsigned long) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abseil-cpp.