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

commit r16-5517-gb579bcfa1c8d719aae27bd35968cc7d6f4c76205
Author: Nathaniel Shead <[email protected]>
Date:   Thu Oct 23 13:34:01 2025 +1100

    c++: Override input location in diagnose_trait_expr
    
    gcc/cp/ChangeLog:
    
            * constraint.cc (diagnose_trait_expr): Reset input_location.
    
    Signed-off-by: Nathaniel Shead <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Diff:
---
 gcc/cp/constraint.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index e99c604babfe..5b7eb36b4608 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3075,6 +3075,9 @@ diagnose_trait_expr (location_t loc, tree expr, tree args)
 
   tree t1 = TRAIT_EXPR_TYPE1 (expr);
   tree t2 = TRAIT_EXPR_TYPE2 (expr);
+  gcc_checking_assert (t1 != error_mark_node && t2 != error_mark_node);
+
+  iloc_sentinel ils (loc);
 
   /* For traits intrinsically about the properties of user-defined types,
      decl_loc will point to the declaration of that type.  */

Reply via email to