An expression used inside a grouping_element can be an input column name, or the name or ordinal number of an output column (SELECT list item), or an arbitrary expression formed from input-column values.
whereas the discussion of HAVING does not mention allowing output columns. The reason for this is mainly that it'd seldom be useful for a HAVING expression to be just a bare column reference, but as soon as you write something that's not a bare column reference, the output-column special case is disallowed anyway.
Tom, the HAVING clause section has:
> ... Each column referenced in condition must unambiguously reference a grouping column, ...
I suppose "grouping column" can be read to mean what is called "grouping element" in GROUP BY section and that it may be either input or output column, leading to the confusion.
Perhaps this phrase can be improved to make this clearer.