c++: Use STATIC_ASSERT for OVL_OP_MAX.
authorMartin Liska <mliska@suse.cz>
Fri, 12 Mar 2021 13:32:07 +0000 (14:32 +0100)
committerMartin Liska <mliska@suse.cz>
Fri, 23 Apr 2021 07:37:18 +0000 (09:37 +0200)
gcc/cp/ChangeLog:

* cp-tree.h (STATIC_ASSERT): Prefer static assert.
* lex.c (init_operators): Remove run-time check.

gcc/cp/cp-tree.h
gcc/cp/lex.c

index 23a77a2..cb254e0 100644 (file)
@@ -5922,6 +5922,9 @@ enum ovl_op_code {
   OVL_OP_MAX
 };
 
+/* Make sure it fits in lang_decl_fn::ovl_op_code. */
+STATIC_ASSERT (OVL_OP_MAX < (1 << 6));
+
 struct GTY(()) ovl_op_info_t {
   /* The IDENTIFIER_NODE for the operator.  */
   tree identifier;
index 73e14b8..43abd01 100644 (file)
@@ -166,8 +166,6 @@ init_operators (void)
 
       if (op_ptr->name)
        {
-         /* Make sure it fits in lang_decl_fn::operator_code. */
-         gcc_checking_assert (op_ptr->ovl_op_code < (1 << 6));
          tree ident = set_operator_ident (op_ptr);
          if (unsigned index = IDENTIFIER_CP_INDEX (ident))
            {