[syserr.errcode.constructors] # 19 Diagnostics library [[diagnostics]](./#diagnostics) ## 19.5 System error support [[syserr]](syserr#errcode.constructors) ### 19.5.4 Class error_code [[syserr.errcode]](syserr.errcode#constructors) #### 19.5.4.2 Constructors [syserr.errcode.constructors] [🔗](#lib:error_code,constructor) `error_code() noexcept; ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1064) *Effects*: Initializes *val_* with 0 and *cat_* with &system_category()[.](#1.sentence-1) [🔗](#lib:error_code,constructor_) `error_code(int val, const error_category& cat) noexcept; ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1076) *Effects*: Initializes *val_* with val and *cat_* with &cat[.](#2.sentence-1) [🔗](#lib:error_code,constructor__) `template error_code(ErrorCodeEnum e) noexcept; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1089) *Constraints*: [is_error_code_enum_v](system.error.syn#lib:is_error_code_enum_v "19.5.2 Header synopsis [system.error.syn]") is true[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1093) *Effects*: Equivalent to:error_code ec = make_error_code(e); assign(ec.value(), ec.category());