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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
template <class H>
struct X
{
  static inline long x[] = { 1L };
  long foo () { return x[0]; }
};

void
bar ()
{
  class L {};
  X<L> v {};
}

reproduces it too.
I think the problem is that we don't substitute for the inline static data
members their initializers and call finish_static_data_member_decl with it.
The comment says though:
                          /* In [temp.inst]:

                             [t]he initialization (and any associated
                             side-effects) of a static data member does
                             not occur unless the static data member is
                             itself used in a way that requires the
                             definition of the static data member to
                             exist.

                             Therefore, we do not substitute into the
                             initialized for the static data member here.  */
and I can't find anything that would say that inline vars are to be treated
differently.  Jason?

Reply via email to