]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: gcc_assert(false) replaced with gcc_unreachable()
authorYang Kun <yangkun@disroot.org>
Wed, 8 Apr 2026 13:41:16 +0000 (15:41 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 8 Apr 2026 13:41:16 +0000 (15:41 +0200)
gcc/cp/ChangeLog:
* pt.cc (tsubst_expr): Use gcc_unreachable, not gcc_assert.
* parser.cc (cp_parser_template_id): Likewise.
* reflect.cc (eval_template_of): Likewise.

Signed-off-by: Yang Kun <yangkun@disroot.org>
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/reflect.cc

index 7496a32f6c7d1aba3a5dd0f8145ef11031d319d0..62ae24f559bdab1605713c017acdd9b517889de8 100644 (file)
@@ -21337,7 +21337,7 @@ cp_parser_template_id (cp_parser *parser,
          return error_mark_node;
        }
       else
-       gcc_assert (false);
+       gcc_unreachable ();
 
       template_id = lookup_template_function (templ, arguments);
       if (TREE_CODE (template_id) == TEMPLATE_ID_EXPR)
index 70418e05f9150476b66f3ac52e31bbfb7616d855..c10ca09cdb166d1f9bb26d7843c7cdac76669dea 100644 (file)
@@ -22367,7 +22367,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
                                                 complain);
        else if (concept_check_p (function))
          /* Calls to concepts should have been previously diagnosed.  */
-         gcc_assert (false);
+         gcc_unreachable ();
        else
          ret = finish_call_expr (function, &call_args,
                                  /*disallow_virtual=*/qualified_p,
index 2baeced1e96227ac272901ae31949f19ef69e9f5..3c0e029975d94f64d5d2ec2769cdb8831b32df20 100644 (file)
@@ -2912,7 +2912,7 @@ eval_template_of (location_t loc, const constexpr_ctx *ctx, tree r,
   else if (VAR_OR_FUNCTION_DECL_P (r) && DECL_TEMPLATE_INFO (r))
     r = DECL_TI_TEMPLATE (r);
   else
-    gcc_assert (false);
+    gcc_unreachable ();
 
   gcc_assert (TREE_CODE (r) == TEMPLATE_DECL);
   return get_reflection_raw (loc, r);