Skip to content

Commit 3259e49

Browse files
committed
Silence further maybe-uninitialized warnings
This is newly emitted by GCC 12 when switching to C++17. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 (and related issues) why std::optional's tracking via a `bool` takes GCC off track.
1 parent 1efed70 commit 3259e49

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/util/irep.h

+14
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,15 @@ class sharing_treet
193193
// Copy from rvalue reference.
194194
// Note that this does avoid a branch compared to the
195195
// standard copy constructor above.
196+
// Work around spurious GCC 12 warning about irep.data being uninitialized.
197+
// See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
198+
#pragma GCC diagnostic push
199+
#ifndef __clang__
200+
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
201+
#endif
196202
sharing_treet(sharing_treet &&irep) : data(irep.data)
197203
{
204+
#pragma GCC diagnostic pop
198205
#ifdef IREP_DEBUG
199206
std::cout << "COPY MOVE\n";
200207
#endif
@@ -233,7 +240,14 @@ class sharing_treet
233240

234241
~sharing_treet()
235242
{
243+
// Work around spurious GCC 12 warning about irep.data being uninitialized.
244+
// See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
245+
#pragma GCC diagnostic push
246+
#ifndef __clang__
247+
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
248+
#endif
236249
remove_ref(data);
250+
#pragma GCC diagnostic pop
237251
}
238252

239253
protected:

0 commit comments

Comments
 (0)