[basic.stc.auto]

# 6 Basics [[basic]](./#basic)

## 6.8 Memory and objects [[basic.memobj]](basic.memobj#basic.stc.auto)

### 6.8.6 Storage duration [[basic.stc]](basic.stc#auto)

#### 6.8.6.4 Automatic storage duration [basic.stc.auto]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4337)

Variables that belong to a block scope and are
not explicitly declared static, thread_local, or extern have[*automatic storage duration*](#def:storage_duration,automatic "6.8.6.4 Automatic storage duration [basic.stc.auto]")[.](#1.sentence-1)

The storage
for such variables lasts until the block in which they are created exits[.](#1.sentence-2)

[*Note [1](#note-1)*:

These variables are initialized and destroyed as described in [[stmt.dcl]](stmt.dcl "8.10 Declaration statement")[.](#1.sentence-3)

â *end note*]

Variables that belong to a parameter scope also have automatic storage duration[.](#1.sentence-4)

The storage for a function parameter lasts until
immediately after its destruction ([[expr.call]](expr.call "7.6.1.3 Function call"))[.](#1.sentence-5)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4350)

If a variable with automatic storage duration has initialization or a destructor with side
effects, an implementation shall not destroy it before the end of its block
nor eliminate it 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.elision]](class.copy.elision "11.9.6 Copy/move elision")[.](#2.sentence-1)
