I'm experiencing a strange phenomenon. Here's a (quite artificial) test case:

The following definition work just fine:

    In[1] := f[x___Real]:={x}
    In[2] := g[a_,f[n_Integer]]:={a,n}
    In[3] := SetAttributes[f,Flat]
    In[4] := f[a,f[b,c]]
    Out[4] = f[a,b,c]
    In[5] := g[f[1.0],3]
    Out[5] = g[{1.},3]

As do the following:

    In[1] := f[x___Real]:={x}
    In[2] := SetAttributes[f,Flat]
    In[3] := g[a_,f[n_Integer]]:={a,n}
    In[4] := f[a,f[b,c]]
    Out[4] = f[a,b,c]
    In[5] := g[f[1.0],3]
    Out[5] = g[{1.},3]

However, the following hangs on the definition of `g`:

    In[1] := SetAttributes[f,Flat]
    In[2] := f[x___Real]:={x}
    In[3] := g[a_,f[n_Integer]]:={a,n}

Now I don't see any reason why the of the definition of `g` should depend on whether I've first defined `f` or first set the `Flat` attribute on it. Can anyone explain the mystery?

PS: If anyone can think of a better title, feel free to change it accordingly.