[syserr.errcode.modifiers]

# 19 Diagnostics library [[diagnostics]](./#diagnostics)

## 19.5 System error support [[syserr]](syserr#errcode.modifiers)

### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#modifiers)

#### 19.5.4.3 Modifiers [syserr.errcode.modifiers]

[ð](#lib:assign,error_code)

`void assign(int val, const error_category& cat) noexcept;
`

[1](#1)

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

*Postconditions*: *val_* == val and *cat_* == &cat[.](#1.sentence-1)

[ð](#lib:operator=,error_code)

`template<class ErrorCodeEnum>
  error_code& operator=(ErrorCodeEnum e) noexcept;
`

[2](#2)

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

*Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2 Header <system_­error> synopsis [system.error.syn]")<ErrorCodeEnum> is true[.](#2.sentence-1)

[3](#3)

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

*Effects*: Equivalent to:error_code ec = make_error_code(e);
assign(ec.value(), ec.category());

[4](#4)

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

*Returns*: *this[.](#4.sentence-1)

[ð](#lib:clear,error_code)

`void clear() noexcept;
`

[5](#5)

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

*Postconditions*: value() == 0 and category() == system_category()[.](#5.sentence-1)
