File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,14 @@ class ReferenceCountedStdString final : public ReferenceCounted {
6060 alignas (std::string) char string_[sizeof (std::string)];
6161};
6262
63+ // ReferenceCountedString is non-standard-layout due to having virtual functions
64+ // from a base class. This causes compilers to warn about the use of offsetof(),
65+ // but it still works here, so silence the warning and proceed.
66+ #if defined(__GNUC__) || defined(__clang__)
67+ #pragma GCC diagnostic push
68+ #pragma GCC diagnostic ignored "-Winvalid-offsetof"
69+ #endif
70+
6371class ReferenceCountedString final : public ReferenceCounted {
6472 public:
6573 static const ReferenceCountedString* New (const char * data, size_t size) {
@@ -87,6 +95,10 @@ class ReferenceCountedString final : public ReferenceCounted {
8795 char data_[];
8896};
8997
98+ #if defined(__GNUC__) || defined(__clang__)
99+ #pragma GCC diagnostic pop
100+ #endif
101+
90102} // namespace
91103
92104std::pair<absl::Nonnull<const ReferenceCount*>, absl::string_view>
You can’t perform that action at this time.
0 commit comments