C++N4606(240) 19 Diagnostics library[diagnostics]p517


はじめに(Introduction)

C++N4606 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/#mailing2016-11
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf

C++N4606は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

作業方針(sequence)

1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

C++N4606符号断片編纂一覧(example code compile list)

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

編纂器(Compiler)

clang++ --version

clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.4.0

g++-7 --version

g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.

(240) 19 Diagnostics library[diagnostics]p517

算譜(source code)

p517.cpp
// C++N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "C++N4606(240)  19 Diagnostics library[diagnostics]p517.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>
#include <system_error>
#include <string>

//19.2.1 Header <stdexcept> synopsis [stdexcept.syn]
namespace std {
class logic_error;
class domain_error;
class invalid_argument;
class length_error;
class out_of_range;
class runtime_error;
class range_error;
class overflow_error;
class underflow_error;
}

//19.2.2 Class logic_error [logic.error]
namespace std {
class logic_error : public exception {
public:
  explicit logic_error(const string& what_arg);
  explicit logic_error(const char* what_arg);
};
}

//19.2.3 Class domain_error [domain.error]
namespace std {
class domain_error : public logic_error {
public:
  explicit domain_error(const string& what_arg);
  explicit domain_error(const char* what_arg);
};
}

//19.2.4 Class invalid_argument [invalid.argument]
namespace std {
class invalid_argument : public logic_error {
public:
  explicit invalid_argument(const string& what_arg);
  explicit invalid_argument(const char* what_arg);
};
}

//19.2.5 Class length_error [length.error]
namespace std {
class length_error : public logic_error {
public:
  explicit length_error(const string& what_arg);
  explicit length_error(const char* what_arg);
};
}

//19.2.6 Class out_of_range [out.of.range]
namespace std {
class out_of_range : public logic_error {
public:
  explicit out_of_range(const string& what_arg);
  explicit out_of_range(const char* what_arg);
};
}

//19.2.7 Class runtime_error [runtime.error]
namespace std {
class runtime_error : public exception {
public:
  explicit runtime_error(const string& what_arg);
  explicit runtime_error(const char* what_arg);
};
}

//19.2.8 Class range_error [range.error]
namespace std {
class range_error : public runtime_error {
public:
  explicit range_error(const string& what_arg);
  explicit range_error(const char* what_arg);
};
}

//19.2.9 Class overflow_error [overflow.error]
namespace std {
class overflow_error : public runtime_error {
public:
  explicit overflow_error(const string& what_arg);
  explicit overflow_error(const char* what_arg);
};
}

//19.2.10 Class underflow_error [underflow.error]
namespace std {
class underflow_error : public runtime_error {
public:
  explicit underflow_error(const string& what_arg);
  explicit underflow_error(const char* what_arg);
};
}

//19.5.1 Header <system_error> synopsis [system_error.syn]
namespace std {
class error_category;
const error_category& generic_category() noexcept;
const error_category& system_category() noexcept;
class error_code;
class error_condition;
class system_error;
template <class T>
struct is_error_code_enum : public false_type {};
template <class T>
struct is_error_condition_enum : public false_type {};
enum class errc {
  address_family_not_supported, // EAFNOSUPPORT
  address_in_use, // EADDRINUSE
  address_not_available, // EADDRNOTAVAIL
  already_connected, // EISCONN
  argument_list_too_long, // E2BIG
  argument_out_of_domain, // EDOM
  bad_address, // EFAULT
  bad_file_descriptor, // EBADF
  bad_message, // EBADMSG
  broken_pipe, // EPIPE
  connection_aborted, // ECONNABORTED
  connection_already_in_progress, // EALREADY
  connection_refused, // ECONNREFUSED
  connection_reset, // ECONNRESET
  cross_device_link, // EXDEV
  destination_address_required, // EDESTADDRREQ
  device_or_resource_busy, // EBUSY
  directory_not_empty, // ENOTEMPTY
  executable_format_error, // ENOEXEC
  file_exists, // EEXIST
  file_too_large, // EFBIG
  filename_too_long, // ENAMETOOLONG
  function_not_supported, // ENOSYS
  host_unreachable, // EHOSTUNREACH
  identifier_removed, // EIDRM
  illegal_byte_sequence, // EILSEQ
  inappropriate_io_control_operation, // ENOTTY
  interrupted, // EINTR
  invalid_argument, // EINVAL
  invalid_seek, // ESPIPE
  io_error, // EIO
  is_a_directory, // EISDIR
  message_size, // EMSGSIZE
  network_down, // ENETDOWN
  network_reset, // ENETRESET
  network_unreachable, // ENETUNREACH
  no_buffer_space, // ENOBUFS
  no_child_process, // ECHILD
  no_link, // ENOLINK
  no_lock_available, // ENOLCK
  no_message_available, // ENODATA
  no_message, // ENOMSG
  no_protocol_option, // ENOPROTOOPT
  no_space_on_device, // ENOSPC
  no_stream_resources, // ENOSR
  no_such_device_or_address, // ENXIO
  no_such_device, // ENODEV
  no_such_file_or_directory, // ENOENT
  no_such_process, // ESRCH
  not_a_directory, // ENOTDIR
  not_a_socket, // ENOTSOCK
  not_a_stream, // ENOSTR
  not_connected, // ENOTCONN
  not_enough_memory, // ENOMEM
  not_supported, // ENOTSUP
  operation_canceled, // ECANCELED
  operation_in_progress, // EINPROGRESS
  operation_not_permitted, // EPERM
  operation_not_supported, // EOPNOTSUPP
  operation_would_block, // EWOULDBLOCK
  owner_dead, // EOWNERDEAD
  permission_denied, // EACCES
  protocol_error, // EPROTO
  protocol_not_supported, // EPROTONOSUPPORT
  read_only_file_system, // EROFS
  resource_deadlock_would_occur, // EDEADLK
  resource_unavailable_try_again, // EAGAIN
  result_out_of_range, // ERANGE
  state_not_recoverable, // ENOTRECOVERABLE
  stream_timeout, // ETIME
  text_file_busy, // ETXTBSY
  timed_out, // ETIMEDOUT
  too_many_files_open_in_system, // ENFILE
  too_many_files_open, // EMFILE
  too_many_links, // EMLINK
  too_many_symbolic_link_levels, // ELOOP
  value_too_large, // EOVERFLOW
  wrong_protocol_type, // EPROTOTYPE
};
template <> struct is_error_condition_enum<errc> : true_type {};
error_code make_error_code(errc e) noexcept;
error_condition make_error_condition(errc e) noexcept;
// 19.5.5, comparison operators:
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
// 19.5.6, hash support:
template <class T> struct hash;
template <> struct hash<error_code>;
// 19.5, system error support:
template <class T> constexpr bool is_error_code_enum_v
  = is_error_code_enum<T>::value;
template <class T> constexpr bool is_error_condition_enum_v
  = is_error_condition_enum<T>::value;
}

//19.5.2 Class error_category [syserr.errcat]
//19.5.2.1 Class error_category overview [syserr.errcat.overview]
namespace std {
class error_category {
public:
  constexpr error_category() noexcept;
  virtual ~error_category();
  error_category(const error_category&) = delete;
  error_category& operator=(const error_category&) = delete;
  virtual const char* name() const noexcept = 0;
  virtual error_condition default_error_condition(int ev) const noexcept;
  virtual bool equivalent(int code, const error_condition& condition) const noexcept;
  virtual bool equivalent(const error_code& code, int condition) const noexcept;
  virtual string message(int ev) const = 0;
  bool operator==(const error_category& rhs) const noexcept;
  bool operator!=(const error_category& rhs) const noexcept;
  bool operator<(const error_category& rhs) const noexcept;
};
const error_category& generic_category() noexcept;
const error_category& system_category() noexcept;
} // namespace std

//19.5.2.2 Class error_category virtual members [syserr.errcat.virtuals]
virtual ~error_category();
virtual const char* name() const noexcept = 0;
virtual error_condition default_error_condition(int ev) const noexcept;
virtual bool equivalent(int code, const error_condition& condition) const noexcept;
virtual bool equivalent(const error_code& code, int condition) const noexcept;
virtual string message(int ev) const = 0;

19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
constexpr error_category() noexcept;

bool operator==(const error_category& rhs) const noexcept;

bool operator!=(const error_category& rhs) const noexcept;

bool operator<(const error_category& rhs) const noexcept;


//19.5.2.4 Program defined classes derived from error_category [syserr.errcat.derived]
virtual const char* name() const noexcept = 0;

virtual error_condition default_error_condition(int ev) const noexcept;

virtual bool equivalent(int code, const error_condition& condition) const noexcept;

virtual bool equivalent(const error_code& code, int condition) const noexcept;

//19.5.2.5 Error category objects [syserr.errcat.objects]
const error_category& generic_category() noexcept;
const error_category& system_category() noexcept;

19.5.3 Class error_code [syserr.errcode]
19.5.3.1 Class error_code overview [syserr.errcode.overview]

namespace std {
class error_code {
public:
// 19.5.3.2 constructors:
  error_code() noexcept;
  error_code(int val, const error_category& cat) noexcept;
  template <class ErrorCodeEnum>
  error_code(ErrorCodeEnum e) noexcept;
// 19.5.3.3 modifiers:
  void assign(int val, const error_category& cat) noexcept;
  template <class ErrorCodeEnum>
  error_code& operator=(ErrorCodeEnum e) noexcept;
  void clear() noexcept;
// 19.5.3.4 observers:
  int value() const noexcept;
  const error_category& category() const noexcept;
  error_condition default_error_condition() const noexcept;
  string message() const;
  explicit operator bool() const noexcept;
private:
  int val_; // exposition only
  const error_category* cat_; // exposition only
};
// 19.5.3.5 non-member functions:
error_code make_error_code(errc e) noexcept;
bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
template <class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
} // namespace std

namespace std {
class error_code {
public:
// 19.5.3.2 constructors:
  error_code() noexcept;
  error_code(int val, const error_category& cat) noexcept;
  template <class ErrorCodeEnum>
  error_code(ErrorCodeEnum e) noexcept;
// 19.5.3.3 modifiers:
  void assign(int val, const error_category& cat) noexcept;
  template <class ErrorCodeEnum>
  error_code& operator=(ErrorCodeEnum e) noexcept;
  void clear() noexcept;
// 19.5.3.4 observers:
  int value() const noexcept;
  const error_category& category() const noexcept;
  error_condition default_error_condition() const noexcept;
  string message() const;
  explicit operator bool() const noexcept;
private:
  int val_; // exposition only
  const error_category* cat_; // exposition only
};
// 19.5.3.5 Class error_code non-member functions:
error_code make_error_code(errc e) noexcept;
bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
template <class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
} // namespace std

//19.5.4 Class error_condition [syserr.errcondition]
//19.5.4.1 Class error_condition overview [syserr.errcondition.overview]
namespace std {
class error_condition {
public:
// 19.5.4.2 constructors:
  error_condition() noexcept;
  error_condition(int val, const error_category& cat) noexcept;
  template <class ErrorConditionEnum>
  error_condition(ErrorConditionEnum e) noexcept;
// 19.5.4.3 modifiers:
  void assign(int val, const error_category& cat) noexcept;
  template <class ErrorConditionEnum>
  error_condition& operator=(ErrorConditionEnum e) noexcept;
  void clear() noexcept;
// 19.5.4.4 observers:
  int value() const noexcept;
  const error_category& category() const noexcept;
  string message() const;
  explicit operator bool() const noexcept;
private:
  int val_; // exposition only
  const error_category* cat_; // exposition only
};
// 19.5.4.5 non-member functions:
bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
} // namespace std

//19.5.5 Comparison operators [syserr.compare]
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;

//19.5.6 System error hash support [syserr.hash]
template <> struct hash<error_code>;

//19.5.7 Class system_error [syserr.syserr]
//19.5.7.1 Class system_error overview [syserr.syserr.overview]
namespace std {
class system_error : public runtime_error {
public:
  system_error(error_code ec, const string& what_arg);
  system_error(error_code ec, const char* what_arg);
  system_error(error_code ec);
  system_error(int ev, const error_category& ecat,
               const string& what_arg);
  system_error(int ev, const error_category& ecat,
               const char* what_arg);
  system_error(int ev, const error_category& ecat);
  const error_code& code() const noexcept;
  const char* what() const noexcept;
};
} // namespace std


int main() {
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

編纂・実行結果(compile and go)

cppall.sh
$ ./cppall.sh p517
$ clang++ p517.cpp -std=c++03 -Wall
p517.cpp:26:7: error: redefinition of 'logic_error'
class logic_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:77:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI logic_error
                            ^
p517.cpp:35:7: error: redefinition of 'domain_error'
class domain_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:111:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI domain_error
                            ^
p517.cpp:44:7: error: redefinition of 'invalid_argument'
class invalid_argument : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:121:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI invalid_argument
                            ^
p517.cpp:53:7: error: redefinition of 'length_error'
class length_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:131:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI length_error
                            ^
p517.cpp:62:7: error: redefinition of 'out_of_range'
class out_of_range : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:141:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI out_of_range
                            ^
p517.cpp:71:7: error: redefinition of 'runtime_error'
class runtime_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:94:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI runtime_error
                            ^
p517.cpp:80:7: error: redefinition of 'range_error'
class range_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:151:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI range_error
                            ^
p517.cpp:89:7: error: redefinition of 'overflow_error'
class overflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:161:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI overflow_error
                            ^
p517.cpp:98:7: error: redefinition of 'underflow_error'
class underflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:171:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI underflow_error
                            ^
p517.cpp:108:7: error: reference to 'error_category' is ambiguous
const error_category& generic_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:108:42: error: expected function body after function declarator
const error_category& generic_category() noexcept;
                                         ^
p517.cpp:109:7: error: reference to 'error_category' is ambiguous
const error_category& system_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:109:41: error: expected function body after function declarator
const error_category& system_category() noexcept;
                                        ^
p517.cpp:117:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class errc {
     ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:20: error: explicit specialization of non-template struct 'is_error_condition_enum'
template <> struct is_error_condition_enum<errc> : true_type {};
                   ^                      ~~~~~~
p517.cpp:197:20: error: redefinition of 'is_error_condition_enum' as different kind of symbol
p517.cpp:116:8: note: previous definition is here
struct is_error_condition_enum : public false_type {};
       ^
p517.cpp:198:1: error: reference to 'error_code' is ambiguous
error_code make_error_code(errc e) noexcept;
^
p517.cpp:110:7: note: candidate found by name lookup is 'std::error_code'
class error_code;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:500:24: note: candidate found by name lookup is 'std::__1::error_code'
class _LIBCPP_TYPE_VIS error_code
                       ^
p517.cpp:198:28: error: reference to 'errc' is ambiguous
error_code make_error_code(errc e) noexcept;
                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
$ clang++ p517.cpp -std=c++11 -Wall
p517.cpp:26:7: error: redefinition of 'logic_error'
class logic_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:77:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI logic_error
                            ^
p517.cpp:35:7: error: redefinition of 'domain_error'
class domain_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:111:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI domain_error
                            ^
p517.cpp:44:7: error: redefinition of 'invalid_argument'
class invalid_argument : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:121:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI invalid_argument
                            ^
p517.cpp:53:7: error: redefinition of 'length_error'
class length_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:131:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI length_error
                            ^
p517.cpp:62:7: error: redefinition of 'out_of_range'
class out_of_range : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:141:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI out_of_range
                            ^
p517.cpp:71:7: error: redefinition of 'runtime_error'
class runtime_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:94:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI runtime_error
                            ^
p517.cpp:80:7: error: redefinition of 'range_error'
class range_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:151:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI range_error
                            ^
p517.cpp:89:7: error: redefinition of 'overflow_error'
class overflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:161:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI overflow_error
                            ^
p517.cpp:98:7: error: redefinition of 'underflow_error'
class underflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:171:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI underflow_error
                            ^
p517.cpp:108:7: error: reference to 'error_category' is ambiguous
const error_category& generic_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:109:7: error: reference to 'error_category' is ambiguous
const error_category& system_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:20: error: explicit specialization of non-template struct 'is_error_condition_enum'
template <> struct is_error_condition_enum<errc> : true_type {};
                   ^                      ~~~~~~
p517.cpp:197:20: error: redefinition of 'is_error_condition_enum' as different kind of symbol
p517.cpp:116:8: note: previous definition is here
struct is_error_condition_enum : public false_type {};
       ^
p517.cpp:198:1: error: reference to 'error_code' is ambiguous
error_code make_error_code(errc e) noexcept;
^
p517.cpp:110:7: note: candidate found by name lookup is 'std::error_code'
class error_code;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:500:24: note: candidate found by name lookup is 'std::__1::error_code'
class _LIBCPP_TYPE_VIS error_code
                       ^
p517.cpp:198:28: error: reference to 'errc' is ambiguous
error_code make_error_code(errc e) noexcept;
                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:199:1: error: reference to 'error_condition' is ambiguous
error_condition make_error_condition(errc e) noexcept;
^
p517.cpp:111:7: note: candidate found by name lookup is 'std::error_condition'
class error_condition;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:428:24: note: candidate found by name lookup is 'std::__1::error_condition'
class _LIBCPP_TYPE_VIS error_condition
                       ^
p517.cpp:199:38: error: reference to 'errc' is ambiguous
error_condition make_error_condition(errc e) noexcept;
                                     ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p517.cpp -std=c++17 -Wall
p517.cpp:26:7: error: redefinition of 'logic_error'
class logic_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:77:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI logic_error
                            ^
p517.cpp:35:7: error: redefinition of 'domain_error'
class domain_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:111:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI domain_error
                            ^
p517.cpp:44:7: error: redefinition of 'invalid_argument'
class invalid_argument : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:121:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI invalid_argument
                            ^
p517.cpp:53:7: error: redefinition of 'length_error'
class length_error : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:131:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI length_error
                            ^
p517.cpp:62:7: error: redefinition of 'out_of_range'
class out_of_range : public logic_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:141:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI out_of_range
                            ^
p517.cpp:71:7: error: redefinition of 'runtime_error'
class runtime_error : public exception {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:94:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI runtime_error
                            ^
p517.cpp:80:7: error: redefinition of 'range_error'
class range_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:151:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI range_error
                            ^
p517.cpp:89:7: error: redefinition of 'overflow_error'
class overflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:161:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI overflow_error
                            ^
p517.cpp:98:7: error: redefinition of 'underflow_error'
class underflow_error : public runtime_error {
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/stdexcept:171:29: note: previous definition is here
class _LIBCPP_EXCEPTION_ABI underflow_error
                            ^
p517.cpp:108:7: error: reference to 'error_category' is ambiguous
const error_category& generic_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:109:7: error: reference to 'error_category' is ambiguous
const error_category& system_category() noexcept;
      ^
p517.cpp:107:7: note: candidate found by name lookup is 'std::error_category'
class error_category;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:383:24: note: candidate found by name lookup is 'std::__1::error_category'
class _LIBCPP_TYPE_VIS error_category
                       ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:44: error: reference to 'errc' is ambiguous
template <> struct is_error_condition_enum<errc> : true_type {};
                                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:197:20: error: explicit specialization of non-template struct 'is_error_condition_enum'
template <> struct is_error_condition_enum<errc> : true_type {};
                   ^                      ~~~~~~
p517.cpp:197:20: error: redefinition of 'is_error_condition_enum' as different kind of symbol
p517.cpp:116:8: note: previous definition is here
struct is_error_condition_enum : public false_type {};
       ^
p517.cpp:198:1: error: reference to 'error_code' is ambiguous
error_code make_error_code(errc e) noexcept;
^
p517.cpp:110:7: note: candidate found by name lookup is 'std::error_code'
class error_code;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:500:24: note: candidate found by name lookup is 'std::__1::error_code'
class _LIBCPP_TYPE_VIS error_code
                       ^
p517.cpp:198:28: error: reference to 'errc' is ambiguous
error_code make_error_code(errc e) noexcept;
                           ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
p517.cpp:199:1: error: reference to 'error_condition' is ambiguous
error_condition make_error_condition(errc e) noexcept;
^
p517.cpp:111:7: note: candidate found by name lookup is 'std::error_condition'
class error_condition;
      ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:428:24: note: candidate found by name lookup is 'std::__1::error_condition'
class _LIBCPP_TYPE_VIS error_condition
                       ^
p517.cpp:199:38: error: reference to 'errc' is ambiguous
error_condition make_error_condition(errc e) noexcept;
                                     ^
p517.cpp:117:12: note: candidate found by name lookup is 'std::errc'
enum class errc {
           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/system_error:267:29: note: candidate found by name lookup is 'std::__1::errc'
_LIBCPP_DECLARE_STRONG_ENUM(errc)
                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++-7 p517.cpp -std=c++03  -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:35:0,
                 from p517.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
p517.cpp:108:1: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
 const error_category& generic_category() noexcept;
 ^~~~~
p517.cpp:213:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
 template <class T> constexpr bool is_error_code_enum_v
 ^~~~~~~~
p517.cpp:249:1: error: too many decimal points in number
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:272:1: error: too many decimal points in number
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:273:1: error: too many decimal points in number
 19.5.3.1 Class error_code overview [syserr.errcode.overview]
 ^~~~~~~~
p517.cpp:26:7: error: redefinition of 'class std::logic_error'
 class logic_error : public exception {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:113:9: note: previous definition of 'class std::logic_error'
   class logic_error : public exception
         ^~~~~~~~~~~
p517.cpp:35:7: error: redefinition of 'class std::domain_error'
 class domain_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:147:9: note: previous definition of 'class std::domain_error'
   class domain_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:44:7: error: redefinition of 'class std::invalid_argument'
 class invalid_argument : public logic_error {
       ^~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:158:9: note: previous definition of 'class std::invalid_argument'
   class invalid_argument : public logic_error
         ^~~~~~~~~~~~~~~~
p517.cpp:53:7: error: redefinition of 'class std::length_error'
 class length_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:170:9: note: previous definition of 'class std::length_error'
   class length_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:62:7: error: redefinition of 'class std::out_of_range'
 class out_of_range : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:182:9: note: previous definition of 'class std::out_of_range'
   class out_of_range : public logic_error
         ^~~~~~~~~~~~
p517.cpp:71:7: error: redefinition of 'class std::runtime_error'
 class runtime_error : public exception {
       ^~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:197:9: note: previous definition of 'class std::runtime_error'
   class runtime_error : public exception
         ^~~~~~~~~~~~~
p517.cpp:80:7: error: redefinition of 'class std::range_error'
 class range_error : public runtime_error {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:230:9: note: previous definition of 'class std::range_error'
   class range_error : public runtime_error
         ^~~~~~~~~~~
p517.cpp:89:7: error: redefinition of 'class std::overflow_error'
 class overflow_error : public runtime_error {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:241:9: note: previous definition of 'class std::overflow_error'
   class overflow_error : public runtime_error
         ^~~~~~~~~~~~~~
p517.cpp:98:7: error: redefinition of 'class std::underflow_error'
 class underflow_error : public runtime_error {
       ^~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:252:9: note: previous definition of 'class std::underflow_error'
   class underflow_error : public runtime_error
         ^~~~~~~~~~~~~~~
p517.cpp:108:42: error: expected initializer before 'noexcept'
 const error_category& generic_category() noexcept;
                                          ^~~~~~~~
p517.cpp:109:41: error: expected initializer before 'noexcept'
 const error_category& system_category() noexcept;
                                         ^~~~~~~~
p517.cpp:114:47: error: expected class-name before '{' token
 struct is_error_code_enum : public false_type {};
                                               ^
p517.cpp:116:52: error: expected class-name before '{' token
 struct is_error_condition_enum : public false_type {};
                                                    ^
p517.cpp:117:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11
 enum class errc {
 ^~~~
p517.cpp:197:62: error: expected class-name before '{' token
 template <> struct is_error_condition_enum<errc> : true_type {};
                                                              ^
p517.cpp:198:36: error: expected initializer before 'noexcept'
 error_code make_error_code(errc e) noexcept;
                                    ^~~~~~~~
p517.cpp:199:46: error: expected initializer before 'noexcept'
 error_condition make_error_condition(errc e) noexcept;
                                              ^~~~~~~~
p517.cpp:201:63: error: expected initializer before 'noexcept'
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:202:68: error: expected initializer before 'noexcept'
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:203:68: error: expected initializer before 'noexcept'
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:204:73: error: expected initializer before 'noexcept'
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:205:63: error: expected initializer before 'noexcept'
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:206:68: error: expected initializer before 'noexcept'
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:207:68: error: expected initializer before 'noexcept'
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:208:73: error: expected initializer before 'noexcept'
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:213:20: error: 'constexpr' does not name a type
 template <class T> constexpr bool is_error_code_enum_v
                    ^~~~~~~~~
p517.cpp:213:20: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p517.cpp:215:20: error: 'constexpr' does not name a type
 template <class T> constexpr bool is_error_condition_enum_v
                    ^~~~~~~~~
p517.cpp:215:20: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p517.cpp:224:1: error: 'constexpr' does not name a type
 constexpr error_category() noexcept;
 ^~~~~~~~~
p517.cpp:224:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p517.cpp:226:41: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
 error_category(const error_category&) = delete;
                                         ^~~~~~
p517.cpp:227:52: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
 error_category& operator=(const error_category&) = delete;
                                                    ^~~~~~
p517.cpp:228:28: error: expected ';' at end of member declaration
 virtual const char* name() const noexcept = 0;
                            ^~~~~
p517.cpp:228:34: error: 'noexcept' does not name a type
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:228:34: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:229:57: error: expected ';' at end of member declaration
 virtual error_condition default_error_condition(int ev) const noexcept;
                                                         ^~~~~
p517.cpp:229:63: error: 'noexcept' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
                                                               ^~~~~~~~
p517.cpp:229:63: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:230:69: error: expected ';' at end of member declaration
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                     ^~~~~
p517.cpp:230:75: error: 'noexcept' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:230:75: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:231:64: error: expected ';' at end of member declaration
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                ^~~~~
p517.cpp:231:70: error: 'noexcept' does not name a type
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:231:70: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:233:44: error: expected ';' at end of member declaration
 bool operator==(const error_category& rhs) const noexcept;
                                            ^~~~~
p517.cpp:233:50: error: 'noexcept' does not name a type
 bool operator==(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:233:50: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:234:44: error: expected ';' at end of member declaration
 bool operator!=(const error_category& rhs) const noexcept;
                                            ^~~~~
p517.cpp:234:50: error: 'noexcept' does not name a type
 bool operator!=(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:234:50: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:235:43: error: expected ';' at end of member declaration
 bool operator<(const error_category& rhs) const noexcept;
                                           ^~~~~
p517.cpp:235:49: error: 'noexcept' does not name a type
 bool operator<(const error_category& rhs) const noexcept;
                                                 ^~~~~~~~
p517.cpp:235:49: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:237:42: error: expected initializer before 'noexcept'
 const error_category& generic_category() noexcept;
                                          ^~~~~~~~
p517.cpp:238:41: error: expected initializer before 'noexcept'
 const error_category& system_category() noexcept;
                                         ^~~~~~~~
p517.cpp:242:24: error: expected class-name before '(' token
 virtual ~error_category();
                        ^
p517.cpp:243:34: error: expected initializer before 'noexcept'
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:244:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:245:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:245:75: error: expected initializer before 'noexcept'
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:246:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:246:70: error: expected initializer before 'noexcept'
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:247:9: error: 'string' does not name a type; did you mean 'stdin'?
 virtual string message(int ev) const = 0;
         ^~~~~~
         stdin
p517.cpp:249:1: error: expected unqualified-id before numeric constant
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:252:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator==(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:252:50: error: expected initializer before 'noexcept'
 bool operator==(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:254:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator!=(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:254:50: error: expected initializer before 'noexcept'
 bool operator!=(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:256:22: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator<(const error_category& rhs) const noexcept;
                      ^~~~~~~~~~~~~~
                      _ZTISt14error_category
p517.cpp:256:49: error: expected initializer before 'noexcept'
 bool operator<(const error_category& rhs) const noexcept;
                                                 ^~~~~~~~
p517.cpp:260:34: error: expected initializer before 'noexcept'
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:262:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:264:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:264:75: error: expected initializer before 'noexcept'
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:266:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:266:70: error: expected initializer before 'noexcept'
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:269:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:270:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:272:1: error: expected unqualified-id before numeric constant
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:310:12: error: expected ';' at end of member declaration
 error_code() noexcept;
            ^
p517.cpp:310:14: error: 'noexcept' does not name a type
 error_code() noexcept;
              ^~~~~~~~
p517.cpp:310:14: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:311:46: error: expected ';' at end of member declaration
 error_code(int val, const error_category& cat) noexcept;
                                              ^
p517.cpp:311:48: error: 'noexcept' does not name a type
 error_code(int val, const error_category& cat) noexcept;
                                                ^~~~~~~~
p517.cpp:311:48: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:313:29: error: expected initializer before 'noexcept'
 error_code(ErrorCodeEnum e) noexcept;
                             ^~~~~~~~
p517.cpp:315:47: error: expected ';' at end of member declaration
 void assign(int val, const error_category& cat) noexcept;
                                               ^
p517.cpp:315:49: error: 'noexcept' does not name a type
 void assign(int val, const error_category& cat) noexcept;
                                                 ^~~~~~~~
p517.cpp:315:49: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:317:40: error: expected initializer before 'noexcept'
 error_code& operator=(ErrorCodeEnum e) noexcept;
                                        ^~~~~~~~
p517.cpp:318:12: error: expected ';' at end of member declaration
 void clear() noexcept;
            ^
p517.cpp:318:14: error: 'noexcept' does not name a type
 void clear() noexcept;
              ^~~~~~~~
p517.cpp:318:14: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:320:13: error: expected ';' at end of member declaration
 int value() const noexcept;
             ^~~~~
p517.cpp:320:19: error: 'noexcept' does not name a type
 int value() const noexcept;
                   ^~~~~~~~
p517.cpp:320:19: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:321:34: error: expected ';' at end of member declaration
 const error_category& category() const noexcept;
                                  ^~~~~
p517.cpp:321:40: error: 'noexcept' does not name a type
 const error_category& category() const noexcept;
                                        ^~~~~~~~
p517.cpp:321:40: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:322:43: error: expected ';' at end of member declaration
 error_condition default_error_condition() const noexcept;
                                           ^~~~~
p517.cpp:322:49: error: 'noexcept' does not name a type
 error_condition default_error_condition() const noexcept;
                                                 ^~~~~~~~
p517.cpp:322:49: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:324:26: warning: explicit conversion operators only available with -std=c++11 or -std=gnu++11
 explicit operator bool() const noexcept;
                          ^~~~~
p517.cpp:324:26: error: expected ';' at end of member declaration
p517.cpp:324:32: error: 'noexcept' does not name a type
 explicit operator bool() const noexcept;
                                ^~~~~~~~
p517.cpp:324:32: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:330:36: error: expected initializer before 'noexcept'
 error_code make_error_code(errc e) noexcept;
                                    ^~~~~~~~
p517.cpp:331:62: error: expected initializer before 'noexcept'
 bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
                                                              ^~~~~~~~
p517.cpp:343:17: error: expected ';' at end of member declaration
 error_condition() noexcept;
                 ^
p517.cpp:343:19: error: 'noexcept' does not name a type
 error_condition() noexcept;
                   ^~~~~~~~
p517.cpp:343:19: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:344:51: error: expected ';' at end of member declaration
 error_condition(int val, const error_category& cat) noexcept;
                                                   ^
p517.cpp:344:53: error: 'noexcept' does not name a type
 error_condition(int val, const error_category& cat) noexcept;
                                                     ^~~~~~~~
p517.cpp:344:53: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:346:39: error: expected initializer before 'noexcept'
 error_condition(ErrorConditionEnum e) noexcept;
                                       ^~~~~~~~
p517.cpp:348:47: error: expected ';' at end of member declaration
 void assign(int val, const error_category& cat) noexcept;
                                               ^
p517.cpp:348:49: error: 'noexcept' does not name a type
 void assign(int val, const error_category& cat) noexcept;
                                                 ^~~~~~~~
p517.cpp:348:49: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:350:50: error: expected initializer before 'noexcept'
 error_condition& operator=(ErrorConditionEnum e) noexcept;
                                                  ^~~~~~~~
p517.cpp:351:12: error: expected ';' at end of member declaration
 void clear() noexcept;
            ^
p517.cpp:351:14: error: 'noexcept' does not name a type
 void clear() noexcept;
              ^~~~~~~~
p517.cpp:351:14: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:353:13: error: expected ';' at end of member declaration
 int value() const noexcept;
             ^~~~~
p517.cpp:353:19: error: 'noexcept' does not name a type
 int value() const noexcept;
                   ^~~~~~~~
p517.cpp:353:19: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:354:34: error: expected ';' at end of member declaration
 const error_category& category() const noexcept;
                                  ^~~~~
p517.cpp:354:40: error: 'noexcept' does not name a type
 const error_category& category() const noexcept;
                                        ^~~~~~~~
p517.cpp:354:40: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:356:26: warning: explicit conversion operators only available with -std=c++11 or -std=gnu++11
 explicit operator bool() const noexcept;
                          ^~~~~
p517.cpp:356:26: error: expected ';' at end of member declaration
p517.cpp:356:32: error: 'noexcept' does not name a type
 explicit operator bool() const noexcept;
                                ^~~~~~~~
p517.cpp:356:32: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:362:72: error: expected initializer before 'noexcept'
 bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                        ^~~~~~~~
p517.cpp:366:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:366:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:366:63: error: expected initializer before 'noexcept'
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:367:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:367:46: error: 'error_condition' does not name a type
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:367:68: error: expected initializer before 'noexcept'
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:368:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:368:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:368:68: error: expected initializer before 'noexcept'
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:369:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:369:51: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:369:73: error: expected initializer before 'noexcept'
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:370:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:370:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:370:63: error: expected initializer before 'noexcept'
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:371:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:371:46: error: 'error_condition' does not name a type
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:371:68: error: expected initializer before 'noexcept'
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:372:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:372:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:372:68: error: expected initializer before 'noexcept'
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:373:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:373:51: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:373:73: error: expected initializer before 'noexcept'
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:376:20: error: 'hash' is not a class template
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:376:25: error: 'error_code' was not declared in this scope
 template <> struct hash<error_code>;
                         ^~~~~~~~~~
p517.cpp:376:25: note: suggested alternative:
p517.cpp:307:7: note:   'std::error_code'
 class error_code {
       ^~~~~~~~~~
p517.cpp:376:20: error: explicit specialization of non-template 'hash'
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:391:26: error: expected ';' at end of member declaration
 const error_code& code() const noexcept;
                          ^~~~~
p517.cpp:391:32: error: 'noexcept' does not name a type
 const error_code& code() const noexcept;
                                ^~~~~~~~
p517.cpp:391:32: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:392:20: error: expected ';' at end of member declaration
 const char* what() const noexcept;
                    ^~~~~
p517.cpp:392:26: error: 'noexcept' does not name a type
 const char* what() const noexcept;
                          ^~~~~~~~
p517.cpp:392:26: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
p517.cpp:392:13: error: looser throw specifier for 'virtual const char* std::system_error::what() const'
 const char* what() const noexcept;
             ^~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:44:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:221:5: error:   overriding 'virtual const char* std::runtime_error::what() const throw ()'
     what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
     ^~~~

$ g++-7 p517.cpp -std=c++11  -Wall
p517.cpp:249:1: error: too many decimal points in number
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:272:1: error: too many decimal points in number
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:273:1: error: too many decimal points in number
 19.5.3.1 Class error_code overview [syserr.errcode.overview]
 ^~~~~~~~
p517.cpp:26:7: error: redefinition of 'class std::logic_error'
 class logic_error : public exception {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:113:9: note: previous definition of 'class std::logic_error'
   class logic_error : public exception
         ^~~~~~~~~~~
p517.cpp:35:7: error: redefinition of 'class std::domain_error'
 class domain_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:147:9: note: previous definition of 'class std::domain_error'
   class domain_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:44:7: error: redefinition of 'class std::invalid_argument'
 class invalid_argument : public logic_error {
       ^~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:158:9: note: previous definition of 'class std::invalid_argument'
   class invalid_argument : public logic_error
         ^~~~~~~~~~~~~~~~
p517.cpp:53:7: error: redefinition of 'class std::length_error'
 class length_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:170:9: note: previous definition of 'class std::length_error'
   class length_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:62:7: error: redefinition of 'class std::out_of_range'
 class out_of_range : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:182:9: note: previous definition of 'class std::out_of_range'
   class out_of_range : public logic_error
         ^~~~~~~~~~~~
p517.cpp:71:7: error: redefinition of 'class std::runtime_error'
 class runtime_error : public exception {
       ^~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:197:9: note: previous definition of 'class std::runtime_error'
   class runtime_error : public exception
         ^~~~~~~~~~~~~
p517.cpp:80:7: error: redefinition of 'class std::range_error'
 class range_error : public runtime_error {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:230:9: note: previous definition of 'class std::range_error'
   class range_error : public runtime_error
         ^~~~~~~~~~~
p517.cpp:89:7: error: redefinition of 'class std::overflow_error'
 class overflow_error : public runtime_error {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:241:9: note: previous definition of 'class std::overflow_error'
   class overflow_error : public runtime_error
         ^~~~~~~~~~~~~~
p517.cpp:98:7: error: redefinition of 'class std::underflow_error'
 class underflow_error : public runtime_error {
       ^~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:252:9: note: previous definition of 'class std::underflow_error'
   class underflow_error : public runtime_error
         ^~~~~~~~~~~~~~~
p517.cpp:108:7: error: reference to 'error_category' is ambiguous
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:107:7: note: candidates are: class std::error_category
 class error_category;
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:109:7: error: reference to 'error_category' is ambiguous
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:107:7: note: candidates are: class std::error_category
 class error_category;
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:114:8: error: redefinition of 'struct std::is_error_code_enum<_Tp>'
 struct is_error_code_enum : public false_type {};
        ^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:53:12: note: previous definition of 'struct std::is_error_code_enum<_Tp>'
     struct is_error_code_enum : public false_type { };
            ^~~~~~~~~~~~~~~~~~
p517.cpp:116:8: error: redefinition of 'struct std::is_error_condition_enum<_Tp>'
 struct is_error_condition_enum : public false_type {};
        ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:57:12: note: previous definition of 'struct std::is_error_condition_enum<_Tp>'
     struct is_error_condition_enum : public false_type { };
            ^~~~~~~~~~~~~~~~~~~~~~~
p517.cpp:117:12: error: multiple definition of 'enum class std::errc'
 enum class errc {
            ^~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:39:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/x86_64-apple-darwin17.4.0/bits/error_constants.h:40:14: note: previous definition here
   enum class errc
              ^~~~
p517.cpp:197:20: error: redefinition of 'struct std::is_error_condition_enum<std::errc>'
 template <> struct is_error_condition_enum<errc> : true_type {};
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:60:12: note: previous definition of 'struct std::is_error_condition_enum<std::errc>'
     struct is_error_condition_enum<errc>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p517.cpp:213:35: warning: variable templates only available with -std=c++14 or -std=gnu++14
 template <class T> constexpr bool is_error_code_enum_v
                                   ^~~~~~~~~~~~~~~~~~~~
p517.cpp:215:35: warning: variable templates only available with -std=c++14 or -std=gnu++14
 template <class T> constexpr bool is_error_condition_enum_v
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
p517.cpp:237:7: error: reference to 'error_category' is ambiguous
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:222:7: note: candidates are: class std::error_category
 class error_category {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:238:7: error: reference to 'error_category' is ambiguous
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:222:7: note: candidates are: class std::error_category
 class error_category {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:242:24: error: expected class-name before '(' token
 virtual ~error_category();
                        ^
p517.cpp:243:1: error: 'virtual' outside class declaration
 virtual const char* name() const noexcept = 0;
 ^~~~~~~
p517.cpp:243:34: error: non-member function 'const char* name()' cannot have cv-qualifier
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:243:45: error: function 'const char* name()' is initialized like a variable
 virtual const char* name() const noexcept = 0;
                                             ^
p517.cpp:244:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:245:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:245:1: error: 'virtual' outside class declaration
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
 ^~~~~~~
p517.cpp:245:75: error: non-member function 'bool equivalent(int, const int&)' cannot have cv-qualifier
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:246:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:246:1: error: 'virtual' outside class declaration
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
 ^~~~~~~
p517.cpp:246:70: error: non-member function 'bool equivalent(const int&, int)' cannot have cv-qualifier
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:247:9: error: 'string' does not name a type; did you mean 'stdin'?
 virtual string message(int ev) const = 0;
         ^~~~~~
         stdin
p517.cpp:249:1: error: expected unqualified-id before numeric constant
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:252:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator==(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:252:50: error: non-member function 'bool operator==(const int&)' cannot have cv-qualifier
 bool operator==(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:252:50: error: 'bool operator==(const int&)' must have an argument of class or enumerated type
p517.cpp:254:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator!=(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:254:50: error: non-member function 'bool operator!=(const int&)' cannot have cv-qualifier
 bool operator!=(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:254:50: error: 'bool operator!=(const int&)' must have an argument of class or enumerated type
p517.cpp:256:22: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator<(const error_category& rhs) const noexcept;
                      ^~~~~~~~~~~~~~
                      _ZTISt14error_category
p517.cpp:256:49: error: non-member function 'bool operator<(const int&)' cannot have cv-qualifier
 bool operator<(const error_category& rhs) const noexcept;
                                                 ^~~~~~~~
p517.cpp:256:49: error: 'bool operator<(const int&)' must have an argument of class or enumerated type
p517.cpp:260:1: error: 'virtual' outside class declaration
 virtual const char* name() const noexcept = 0;
 ^~~~~~~
p517.cpp:260:34: error: non-member function 'const char* name()' cannot have cv-qualifier
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:260:45: error: function 'const char* name()' is initialized like a variable
 virtual const char* name() const noexcept = 0;
                                             ^
p517.cpp:262:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:264:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:264:1: error: 'virtual' outside class declaration
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
 ^~~~~~~
p517.cpp:264:75: error: non-member function 'bool equivalent(int, const int&)' cannot have cv-qualifier
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:266:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:266:1: error: 'virtual' outside class declaration
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
 ^~~~~~~
p517.cpp:266:70: error: non-member function 'bool equivalent(const int&, int)' cannot have cv-qualifier
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:269:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:270:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:272:1: error: expected unqualified-id before numeric constant
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:307:7: error: redefinition of 'class std::error_code'
 class error_code {
       ^~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:146:10: note: previous definition of 'class std::error_code'
   struct error_code
          ^~~~~~~~~~
p517.cpp:340:7: error: redefinition of 'class std::error_condition'
 class error_condition {
       ^~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:224:10: note: previous definition of 'class std::error_condition'
   struct error_condition
          ^~~~~~~~~~~~~~~
p517.cpp:366:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:366:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:366:63: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:367:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:367:46: error: 'error_condition' does not name a type
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:367:68: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:368:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:368:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:368:68: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:369:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:369:51: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:369:73: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:370:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:370:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:370:63: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:371:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:371:46: error: 'error_condition' does not name a type
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:371:68: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:372:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:372:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:372:68: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:373:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:373:51: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:373:73: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:376:20: error: 'hash' is not a class template
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:376:25: error: 'error_code' was not declared in this scope
 template <> struct hash<error_code>;
                         ^~~~~~~~~~
p517.cpp:376:25: note: suggested alternative:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:146:10: note:   'std::error_code'
   struct error_code
          ^~~~~~~~~~
p517.cpp:376:20: error: explicit specialization of non-template 'hash'
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:381:7: error: redefinition of 'class std::system_error'
 class system_error : public runtime_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:341:9: note: previous definition of 'class std::system_error'
   class system_error : public std::runtime_error
         ^~~~~~~~~~~~

$ g++-7 p517.cpp -std=c++17  -Wall
p517.cpp:249:1: error: too many decimal points in number
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:272:1: error: too many decimal points in number
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:273:1: error: too many decimal points in number
 19.5.3.1 Class error_code overview [syserr.errcode.overview]
 ^~~~~~~~
p517.cpp:26:7: error: redefinition of 'class std::logic_error'
 class logic_error : public exception {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:113:9: note: previous definition of 'class std::logic_error'
   class logic_error : public exception
         ^~~~~~~~~~~
p517.cpp:35:7: error: redefinition of 'class std::domain_error'
 class domain_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:147:9: note: previous definition of 'class std::domain_error'
   class domain_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:44:7: error: redefinition of 'class std::invalid_argument'
 class invalid_argument : public logic_error {
       ^~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:158:9: note: previous definition of 'class std::invalid_argument'
   class invalid_argument : public logic_error
         ^~~~~~~~~~~~~~~~
p517.cpp:53:7: error: redefinition of 'class std::length_error'
 class length_error : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:170:9: note: previous definition of 'class std::length_error'
   class length_error : public logic_error
         ^~~~~~~~~~~~
p517.cpp:62:7: error: redefinition of 'class std::out_of_range'
 class out_of_range : public logic_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:182:9: note: previous definition of 'class std::out_of_range'
   class out_of_range : public logic_error
         ^~~~~~~~~~~~
p517.cpp:71:7: error: redefinition of 'class std::runtime_error'
 class runtime_error : public exception {
       ^~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:197:9: note: previous definition of 'class std::runtime_error'
   class runtime_error : public exception
         ^~~~~~~~~~~~~
p517.cpp:80:7: error: redefinition of 'class std::range_error'
 class range_error : public runtime_error {
       ^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:230:9: note: previous definition of 'class std::range_error'
   class range_error : public runtime_error
         ^~~~~~~~~~~
p517.cpp:89:7: error: redefinition of 'class std::overflow_error'
 class overflow_error : public runtime_error {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:241:9: note: previous definition of 'class std::overflow_error'
   class overflow_error : public runtime_error
         ^~~~~~~~~~~~~~
p517.cpp:98:7: error: redefinition of 'class std::underflow_error'
 class underflow_error : public runtime_error {
       ^~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/stdexcept:252:9: note: previous definition of 'class std::underflow_error'
   class underflow_error : public runtime_error
         ^~~~~~~~~~~~~~~
p517.cpp:108:7: error: reference to 'error_category' is ambiguous
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:107:7: note: candidates are: class std::error_category
 class error_category;
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:109:7: error: reference to 'error_category' is ambiguous
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:107:7: note: candidates are: class std::error_category
 class error_category;
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:114:8: error: redefinition of 'struct std::is_error_code_enum<_Tp>'
 struct is_error_code_enum : public false_type {};
        ^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:53:12: note: previous definition of 'struct std::is_error_code_enum<_Tp>'
     struct is_error_code_enum : public false_type { };
            ^~~~~~~~~~~~~~~~~~
p517.cpp:116:8: error: redefinition of 'struct std::is_error_condition_enum<_Tp>'
 struct is_error_condition_enum : public false_type {};
        ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:57:12: note: previous definition of 'struct std::is_error_condition_enum<_Tp>'
     struct is_error_condition_enum : public false_type { };
            ^~~~~~~~~~~~~~~~~~~~~~~
p517.cpp:117:12: error: multiple definition of 'enum class std::errc'
 enum class errc {
            ^~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:39:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/x86_64-apple-darwin17.4.0/bits/error_constants.h:40:14: note: previous definition here
   enum class errc
              ^~~~
p517.cpp:197:20: error: redefinition of 'struct std::is_error_condition_enum<std::errc>'
 template <> struct is_error_condition_enum<errc> : true_type {};
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:60:12: note: previous definition of 'struct std::is_error_condition_enum<std::errc>'
     struct is_error_condition_enum<errc>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p517.cpp:237:7: error: reference to 'error_category' is ambiguous
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:222:7: note: candidates are: class std::error_category
 class error_category {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:238:7: error: reference to 'error_category' is ambiguous
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
p517.cpp:222:7: note: candidates are: class std::error_category
 class error_category {
       ^~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:74:9: note:                 class std::_V2::error_category
   class error_category
         ^~~~~~~~~~~~~~
p517.cpp:242:24: error: expected class-name before '(' token
 virtual ~error_category();
                        ^
p517.cpp:243:1: error: 'virtual' outside class declaration
 virtual const char* name() const noexcept = 0;
 ^~~~~~~
p517.cpp:243:34: error: non-member function 'const char* name()' cannot have cv-qualifier
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:243:45: error: function 'const char* name()' is initialized like a variable
 virtual const char* name() const noexcept = 0;
                                             ^
p517.cpp:244:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:245:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:245:1: error: 'virtual' outside class declaration
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
 ^~~~~~~
p517.cpp:245:75: error: non-member function 'bool equivalent(int, const int&)' cannot have cv-qualifier
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:246:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:246:1: error: 'virtual' outside class declaration
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
 ^~~~~~~
p517.cpp:246:70: error: non-member function 'bool equivalent(const int&, int)' cannot have cv-qualifier
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:247:9: error: 'string' does not name a type; did you mean 'stdin'?
 virtual string message(int ev) const = 0;
         ^~~~~~
         stdin
p517.cpp:249:1: error: expected unqualified-id before numeric constant
 19.5.2.3 Class error_category non-virtual members [syserr.errcat.nonvirtuals]
 ^~~~~~~~
p517.cpp:252:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator==(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:252:50: error: non-member function 'bool operator==(const int&)' cannot have cv-qualifier
 bool operator==(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:252:50: error: 'bool operator==(const int&)' must have an argument of class or enumerated type
p517.cpp:254:23: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator!=(const error_category& rhs) const noexcept;
                       ^~~~~~~~~~~~~~
                       _ZTISt14error_category
p517.cpp:254:50: error: non-member function 'bool operator!=(const int&)' cannot have cv-qualifier
 bool operator!=(const error_category& rhs) const noexcept;
                                                  ^~~~~~~~
p517.cpp:254:50: error: 'bool operator!=(const int&)' must have an argument of class or enumerated type
p517.cpp:256:22: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 bool operator<(const error_category& rhs) const noexcept;
                      ^~~~~~~~~~~~~~
                      _ZTISt14error_category
p517.cpp:256:49: error: non-member function 'bool operator<(const int&)' cannot have cv-qualifier
 bool operator<(const error_category& rhs) const noexcept;
                                                 ^~~~~~~~
p517.cpp:256:49: error: 'bool operator<(const int&)' must have an argument of class or enumerated type
p517.cpp:260:1: error: 'virtual' outside class declaration
 virtual const char* name() const noexcept = 0;
 ^~~~~~~
p517.cpp:260:34: error: non-member function 'const char* name()' cannot have cv-qualifier
 virtual const char* name() const noexcept = 0;
                                  ^~~~~~~~
p517.cpp:260:45: error: function 'const char* name()' is initialized like a variable
 virtual const char* name() const noexcept = 0;
                                             ^
p517.cpp:262:9: error: 'error_condition' does not name a type
 virtual error_condition default_error_condition(int ev) const noexcept;
         ^~~~~~~~~~~~~~~
p517.cpp:264:41: error: 'error_condition' does not name a type
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                         ^~~~~~~~~~~~~~~
p517.cpp:264:1: error: 'virtual' outside class declaration
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
 ^~~~~~~
p517.cpp:264:75: error: non-member function 'bool equivalent(int, const int&)' cannot have cv-qualifier
 virtual bool equivalent(int code, const error_condition& condition) const noexcept;
                                                                           ^~~~~~~~
p517.cpp:266:31: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                               ^~~~~~~~~~
                               w_retcode
p517.cpp:266:1: error: 'virtual' outside class declaration
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
 ^~~~~~~
p517.cpp:266:70: error: non-member function 'bool equivalent(const int&, int)' cannot have cv-qualifier
 virtual bool equivalent(const error_code& code, int condition) const noexcept;
                                                                      ^~~~~~~~
p517.cpp:269:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& generic_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:270:7: error: 'error_category' does not name a type; did you mean '_ZTISt14error_category'?
 const error_category& system_category() noexcept;
       ^~~~~~~~~~~~~~
       _ZTISt14error_category
p517.cpp:272:1: error: expected unqualified-id before numeric constant
 19.5.3 Class error_code [syserr.errcode]
 ^~~~~~
p517.cpp:307:7: error: redefinition of 'class std::error_code'
 class error_code {
       ^~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:146:10: note: previous definition of 'class std::error_code'
   struct error_code
          ^~~~~~~~~~
p517.cpp:340:7: error: redefinition of 'class std::error_condition'
 class error_condition {
       ^~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:224:10: note: previous definition of 'class std::error_condition'
   struct error_condition
          ^~~~~~~~~~~~~~~
p517.cpp:366:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:366:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:366:63: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:367:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:367:46: error: 'error_condition' does not name a type
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:367:68: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:368:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:368:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:368:68: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:369:23: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:369:51: error: 'error_condition' does not name a type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:369:73: error: 'bool operator==(const int&, const int&)' must have an argument of class or enumerated type
 bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:370:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:370:46: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                              ^~~~~~~~~~
                                              w_retcode
p517.cpp:370:63: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
                                                               ^~~~~~~~
p517.cpp:371:23: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~
                       w_retcode
p517.cpp:371:46: error: 'error_condition' does not name a type
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                              ^~~~~~~~~~~~~~~
p517.cpp:371:68: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:372:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:372:51: error: 'error_code' does not name a type; did you mean 'w_retcode'?
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                   ^~~~~~~~~~
                                                   w_retcode
p517.cpp:372:68: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
                                                                    ^~~~~~~~
p517.cpp:373:23: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                       ^~~~~~~~~~~~~~~
p517.cpp:373:51: error: 'error_condition' does not name a type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                   ^~~~~~~~~~~~~~~
p517.cpp:373:73: error: 'bool operator!=(const int&, const int&)' must have an argument of class or enumerated type
 bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
                                                                         ^~~~~~~~
p517.cpp:376:20: error: 'hash' is not a class template
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:376:25: error: 'error_code' was not declared in this scope
 template <> struct hash<error_code>;
                         ^~~~~~~~~~
p517.cpp:376:25: note: suggested alternative:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:146:10: note:   'std::error_code'
   struct error_code
          ^~~~~~~~~~
p517.cpp:376:20: error: explicit specialization of non-template 'hash'
 template <> struct hash<error_code>;
                    ^~~~
p517.cpp:381:7: error: redefinition of 'class std::system_error'
 class system_error : public runtime_error {
       ^~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:46:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p517.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:341:9: note: previous definition of 'class std::system_error'
   class system_error : public std::runtime_error
         ^~~~~~~~~~~~

検討事項(agenda)

コンパイルエラーの分類
役に立つまたは意味のある出力

参考資料(reference)

N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

文書履歴(document history)

ver. 0.10 初稿 20180430