https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108395

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is will most likely fix it, but I am not 100% sure it fixes all of the
constexpr cases though:
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index e06f052eb46..3a169eceece 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -2154,7 +2154,10 @@ maybe_get_constexpr_init (tree expr)
       && C_DECL_DECLARED_CONSTEXPR (decl)
       && DECL_INITIAL (decl) != NULL_TREE
       && !error_operand_p (DECL_INITIAL (decl)))
-    return DECL_INITIAL (decl);
+    {
+      mark_exp_read (decl);
+      return DECL_INITIAL (decl);
+    }
   if (TREE_CODE (expr) != COMPONENT_REF)
     return NULL_TREE;
   tree inner = maybe_get_constexpr_init (TREE_OPERAND (expr, 0));

Reply via email to