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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem here is that (in mark_use) the maybe_constant_value call doesn't
evaluate c to (int &) &g in a template, so we don't see through the reference,
so we don't see that &g is TREE_CONSTANT, so we capture.

One of the reasons is
      else if (TYPE_REF_P (TREE_TYPE (expression)))
        /* FIXME cp_finish_decl doesn't fold reference initializers.  */
        return true;
in value_dependent_expression_p but even if that changed, we still wouldn't get
the referent because decl_really_constant_value wouldn't give it to us.

Reply via email to