https://gcc.gnu.org/g:a0fb421786d4cdc18a12954f4c87c8df5c1fece8

commit r17-6498-ga0fb421786d4cdc18a12954f4c87c8df5c1fece8
Author: Marek Polacek <[email protected]>
Date:   Wed Nov 18 12:57:33 2026 -0500

    c++/reflection: set *non_constant_p on error path
    
    This error path fails to set *non_constant_p.
    
    gcc/cp/ChangeLog:
    
            * reflect.cc (get_meta_exception_object): Set *non_constant_p
            after giving an error.
    
    Reviewed-by: Jason Merrill <[email protected]>

Diff:
---
 gcc/cp/reflect.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc
index a7cb236f9b18..60f1d0b182da 100644
--- a/gcc/cp/reflect.cc
+++ b/gcc/cp/reflect.cc
@@ -1134,6 +1134,7 @@ get_meta_exception_object (location_t loc, const 
constexpr_ctx *ctx,
   if (TREE_CODE (type) != TYPE_DECL || !CLASS_TYPE_P (TREE_TYPE (type)))
     {
       error_at (loc, "couldn%'t throw %qs", "std::meta::exception");
+      *non_constant_p = true;
       return NULL_TREE;
     }
   type = TREE_TYPE (type);

Reply via email to