This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1714. odr-use of this from a local class

Section: 11.6  [class.local]     Status: NAD     Submitter: David Krauss     Date: 2013-07-10

According to 11.6 [class.local] paragraph 1,

Declarations in a local class shall not odr-use (6.3 [basic.def.odr]) a variable with automatic storage duration from an enclosing scope.

This restriction should apply as well to the this pointer when the class is local to a non-static member function.

Rationale (January, 2014):

The restrictions in _N4567_.5.1.1 [expr.prim.general] limiting the locations in which this may appear already prevent uses of the containing member function's this where the local class's this does not hide it.