The first two patches deal with issues with 'this' capture; we were inappropriately capturing 'this' for uses of static members and forming pointers to members, and for uses in unevaluated context. The last patch avoids a crash from recursive use of dfs_walk when instantiating a class with virtual functions using a local class whose scope involves a qualified-id. Tested x86_64-pc-linux-gnu, applying to trunk.