3 Basic concepts [basic]

3.7 Storage duration [basic.stc]

3.7.3 Automatic storage duration [basic.stc.auto]

Block-scope variables explicitly declared register or not explicitly declared static or extern have automatic storage duration. The storage for these entities lasts until the block in which they are created exits.

Note: These variables are initialized and destroyed as described in [stmt.dcl].  — end note ]

If a variable with automatic storage duration has initialization or a destructor with side effects, it shall not be destroyed before the end of its block, nor shall it be eliminated as an optimization even if it appears to be unused, except that a class object or its copy/move may be eliminated as specified in [class.copy].