There are several logical inconsistencies and traps in the current traversal.
This doesn't fix any of them, but
- describes the general expectations of how templates should be traversed
- (mostly) exhaustively records current behavior as a baseline for changes
- lists the apparent bugs in current behavior
See https://github.com/clangd/clangd/issues/1034 for an example of reasonable
code that falls into one of the traps, and some discussion.