[gcc r16-1084] c++: add operator| for WMB_Flags
Jason Merrill
jason@gcc.gnu.org
Tue Jun 3 14:18:23 GMT 2025
https://gcc.gnu.org/g:c18f152447c0ae1ac752d8a14b582d099a329c0c
commit r16-1084-gc18f152447c0ae1ac752d8a14b582d099a329c0c
Author: Jason Merrill <jason@redhat.com>
Date: Sat May 24 14:41:43 2025 -0400
c++: add operator| for WMB_Flags
There are a lot of uses of | on WMB_Flags, that currently need to then be
cast back to WMB_Flags. Let's avoid the need for that.
gcc/cp/ChangeLog:
* name-lookup.h (operator|, operator|=): Define for WMB_Flags.
Diff:
---
gcc/cp/name-lookup.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 4216a515afad..2fa736bd0469 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -501,6 +501,10 @@ enum WMB_Flags
WMB_Hidden = 1 << 3,
WMB_Purview = 1 << 4,
};
+inline WMB_Flags operator|(WMB_Flags x, WMB_Flags y)
+{ return WMB_Flags(+x|y); }
+inline WMB_Flags& operator|=(WMB_Flags& x, WMB_Flags y)
+{ return x = x|y; }
extern unsigned walk_module_binding (tree binding, bitmap partitions,
bool (*)(tree decl, WMB_Flags, void *data),
More information about the Gcc-cvs
mailing list