[dcl.attr.nouniqueaddr]

# 9 Declarations [[dcl]](./#dcl)

## 9.13 Attributes [[dcl.attr]](dcl.attr#nouniqueaddr)

### 9.13.11 No unique address attribute [dcl.attr.nouniqueaddr]

[1](#1)

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

The [*attribute-token*](dcl.attr.grammar#nt:attribute-token "9.13.1 Attribute syntax and semantics [dcl.attr.grammar]") no_unique_address specifies that a non-static data member
is a potentially-overlapping subobject ([[intro.object]](intro.object "6.8.2 Object model"))[.](#1.sentence-1)

No [*attribute-argument-clause*](dcl.attr.grammar#nt:attribute-argument-clause "9.13.1 Attribute syntax and semantics [dcl.attr.grammar]") shall be present[.](#1.sentence-2)

The attribute may appertain to a non-static data member
other than a bit-field[.](#1.sentence-3)

[2](#2)

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

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

The non-static data member can share the address of
another non-static data member or that of a base class,
and any padding that would normally be inserted
at the end of the object
can be reused as storage for other members[.](#2.sentence-1)

â *end note*]

*Recommended practice*: The value of a [*has-attribute-expression*](cpp.cond#nt:has-attribute-expression "15.2 Conditional inclusion [cpp.cond]") for the no_unique_address attribute
should be 0 for a given implementation
unless this attribute can cause a potentially-overlapping subobject
to have zero size[.](#2.sentence-2)

[*Example [1](#example-1)*: template<typename Key, typename Value, typename Hash, typename Pred, typename Allocator>class hash_map {[[no_unique_address]] Hash hasher; [[no_unique_address]] Pred pred; [[no_unique_address]] Allocator alloc;
 Bucket *buckets; // ...public:// ...};

Here, hasher, pred, and alloc could have the same address as buckets if their respective types are all empty[.](#2.sentence-3)

â *end example*]
