29.6  Class template time_point [time.point] C++N4910:2022 (674) p1379.cpp

# はじめに(Introduction)

N4910  Working Draft, Standard for Programming Language C++

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf

n4910は、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）との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

 <この項は書きかけです。順次追記します。>

## 背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに１回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を１０種類以上、最近になって解決できたことがあります。それは、主に次の３つの情報に基づいています。

https://stackoverflow.com

http://ja.cppreference.com/

cpprefjp - C++日本語リファレンス

https://cpprefjp.github.io/

コンパイラの実装状況

https://cpprefjp.github.io/implementation-status.html

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

## 作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの２種類
でコンパイルし、

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

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

### C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list  

https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

### C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010

### C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

### C++N3242, 2011 sample code compile list on clang++ and g++
https://qiita.com/kaizen_nagoya/items/685b5c1a2c17c1bf1318

## 編纂器(Compiler)
### clang++ --version
> Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

### g++- --version
> g++ (GCC) 12.1.0  Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# 29.6  Class template time_point [time.point] C++N4910:2022 (674) p1379.cpp

## 算譜(source code)

```c++:p1379.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "29.6  Class template time_point [time.point] C++N4910:2022 (674) p1379.cpp";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

#include "N4910.h"

using namespace std;

// 29.6.1 General
namespace std::chrono {
template<class Clock, class Duration = typename Clock::duration>
class time_point {
public:
    using clock    = Clock;
    using duration = Duration;
    using rep = typename duration::rep;
    using period = typename duration::period;
private:
    duration d_;
public:
// 29.6.2, construct
    constexpr time_point();
    constexpr explicit time_point(const duration& d);
    template<class Duration2>
// exposition only
// has value epoch
// same as time_point() + d
    constexpr time_point(const time_point<clock, Duration2>& t);
// 29.6.3, observer
    constexpr duration time_since_epoch() const;
// 29.6.4, arithmetic
    constexpr time_point& operator++();
    constexpr time_point operator++(int);
    constexpr time_point& operator--();
    constexpr time_point operator--(int);
    constexpr time_point& operator+=(const duration& d);
    constexpr time_point& operator-=(const duration& d);
// 29.6.5, special values
    static constexpr time_point min() noexcept;
    static constexpr time_point max() noexcept;
};
}
//  If Duration is not a specialization of duration, the program is ill-formed. 29.6.2 Constructors
[time.point.cons]
constexpr time_point();
// Effects: Initializes d_ with d. Such a time_point object represents the epoch + d.
template<class Duration2>
constexpr time_point(const time_point<clock, Duration2>& t);
// Constraints: is_convertible_v<Duration2, duration> is true. Effects: Initializes d_ with t.time_since_epoch().
// 29.6.3 Observer [time.point.observer]
constexpr duration time_since_epoch() const;
// Returns: d_.
// 29.6.4 Arithmetic [time.point.arithmetic]
constexpr time_point& operator++();
// Effects: Equivalent to: ++d_. Returns: *this.
constexpr time_point operator++(int);
// Effects: Equivalent to: return time_point{d_++};
constexpr time_point& operator--();
// Effects: Equivalent to: --d_. Returns: *this.
constexpr time_point operator--(int);
// Effects: Equivalent to: return time_point{d_--};
constexpr time_point& operator+=(const duration& d);
// Effects: Equivalent to: d_ += d. Returns: *this.
constexpr time_point& operator-=(const duration& d);
// Effects: Equivalent to: d_ -= d. Returns: *this.
// 29.6.5 Special values [time.point.special]
static constexpr time_point min() noexcept;
// Returns: time_point(duration::min()). static constexpr time_point max() noexcept;
// Returns: time_point(duration::max()).
// 29.6.6 Non-member arithmetic [time.point.nonmember]
template<class Clock, class Duration1, class Rep2, class Period2>
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
// Returns: CT(lhs.time_since_epoch() + rhs), where CT is the type of the return value.
template<class Rep1, class Period1, class Clock, class Duration2>
constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
        operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
// Returns: rhs + lhs.
template<class Clock, class Duration1, class Rep2, class Period2>
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
// Returns: CT(lhs.time_since_epoch() - rhs), where CT is the type of the return value.
// Returns: lhs.time_since_epoch() - rhs.time_since_epoch().
// 29.6.7 Comparisons [time.point.comparisons]
template<class Clock, class Duration1, class Duration2>
constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
                          template<class Clock, class Duration1, class Duration2>
                          constexpr common_type_t<Duration1, Duration2>
                          operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
                          const time_point<Clock, Duration2>& rhs);
// Returns: lhs.time_since_epoch() == rhs.time_since_epoch().
template<class Clock, class Duration1, class Duration2>
constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
                         const time_point<Clock, Duration2>& rhs);
// Returns: lhs.time_since_epoch() < rhs.time_since_epoch().
template<class Clock, class Duration1, class Duration2>
constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
// Returns: rhs < lhs.
                         const time_point<Clock, Duration2>& rhs);
template<class Clock, class Duration1, class Duration2>
constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
                          const time_point<Clock, Duration2>& rhs);
// Returns: !(rhs < lhs).
template<class Clock, class Duration1, class Duration2>
constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
                          const time_point<Clock, Duration2>& rhs);
// Returns: !(lhs < rhs).
template<class Clock, class Duration1,
         three_way_comparable_with<Duration1> Duration2>
constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs,
                           const time_point<Clock, Duration2>& rhs);
// Returns: lhs.time_since_epoch() <=> rhs.time_since_epoch(). 2
// 9.6.8 Conversions [time.point.cast]
template<class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
// Constraints: ToDuration is a specialization of duration. Returns:
time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
template<class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration> floor(const time_point<Clock, Duration>& tp);
// Constraints: ToDuration is a specialization of duration.
// Returns: time_point<Clock, ToDuration>(floor<ToDuration>(tp.time_since_epoch())).
template<class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration> ceil(const time_point<Clock, Duration>& tp);
// Constraints: ToDuration is a specialization of duration.
// Returns: time_point<Clock, ToDuration>(ceil<ToDuration>(tp.time_since_epoch())).
template<class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration> round(const time_point<Clock, Duration>& tp);
// Constraints: ToDuration is a specialization of duration, and treat_as_floating_point_v<typename ToDuration::rep> is false.
// Returns: time_point<Clock, ToDuration>(round<ToDuration>(tp.time_since_epoch())).
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

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

```ubuntu:bash
$ clang++ p1379.cpp -std=03 -o p1379l -I. -Wall
In file included from p1379.cpp:10:
In file included from ./N4910.h:11:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: 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 \
 ^
p1379.cpp:15:14: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
namespace std::chrono {
             ^~~~~~~~
              { namespace chrono
p1379.cpp:19:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using clock    = Clock;
                     ^
p1379.cpp:20:22: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using duration = Duration;
                     ^
p1379.cpp:21:15: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using rep = typename duration::rep;
              ^
p1379.cpp:22:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using period = typename duration::period;
                 ^
p1379.cpp:27:1: error: unknown type name 'constexpr'
constexpr time_point();
^
p1379.cpp:27:11: error: constructor cannot have a return type
constexpr time_point();
          ^~~~~~~~~~
p1379.cpp:28:1: error: unknown type name 'constexpr'
constexpr explicit time_point(const duration& d); template<class Duration2>
^
p1379.cpp:28:20: error: constructor cannot have a return type
constexpr explicit time_point(const duration& d); template<class Duration2>
                   ^~~~~~~~~~
p1379.cpp:32:7: error: unknown type name 'constexpr'
      constexpr time_point(const time_point<clock, Duration2>& t);
      ^
p1379.cpp:32:17: error: constructor cannot have a return type
      constexpr time_point(const time_point<clock, Duration2>& t);
                ^~~~~~~~~~
p1379.cpp:34:1: error: unknown type name 'constexpr'
constexpr duration time_since_epoch() const;
^
p1379.cpp:34:11: error: duplicate member 'duration'
constexpr duration time_since_epoch() const;
          ^
p1379.cpp:20:11: note: previous declaration is here
    using duration = Duration;
          ^
p1379.cpp:34:19: error: expected ';' at end of declaration list
constexpr duration time_since_epoch() const;
                  ^
                  ;
p1379.cpp:36:1: error: unknown type name 'constexpr'
constexpr time_point& operator++();
^
p1379.cpp:36:21: error: expected ';' at end of declaration list
constexpr time_point& operator++();
                    ^
                    ;
p1379.cpp:37:1: error: unknown type name 'constexpr'
constexpr time_point operator++(int);
^
p1379.cpp:37:21: error: expected ';' at end of declaration list
constexpr time_point operator++(int);
                    ^
                    ;
p1379.cpp:38:1: error: unknown type name 'constexpr'
constexpr time_point& operator--();
^
p1379.cpp:38:21: error: expected ';' at end of declaration list
constexpr time_point& operator--();
                    ^
                    ;
p1379.cpp:39:1: error: unknown type name 'constexpr'
constexpr time_point operator--(int);
^
p1379.cpp:39:21: error: expected ';' at end of declaration list
constexpr time_point operator--(int);
                    ^
                    ;
p1379.cpp:40:1: error: unknown type name 'constexpr'
constexpr time_point& operator+=(const duration& d); constexpr time_point& operator-=(const duration& d);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
$ clang++ p1379.cpp -std=2b -o p1379l -I. -Wall
p1379.cpp:45:6: error: member reference base type 'time_t (time_t *) throw()' (aka 'long (long *) throw()') is not a structure or union
[time.point.cons]
 ~~~~^~~~~~
p1379.cpp:46:1: error: expected unqualified-id
constexpr time_point();
^
p1379.cpp:49:16: error: no template named 'time_point'; did you mean 'std::chrono::time_point'?
     constexpr time_point(const time_point<clock, Duration2>& t);
               ^~~~~~~~~~
               std::chrono::time_point
p1379.cpp:17:9: note: 'std::chrono::time_point' declared here
  class time_point {
        ^
p1379.cpp:49:33: error: no template named 'time_point'; did you mean 'std::chrono::time_point'?
     constexpr time_point(const time_point<clock, Duration2>& t);
                                ^~~~~~~~~~
                                std::chrono::time_point
p1379.cpp:17:9: note: 'std::chrono::time_point' declared here
  class time_point {
        ^
p1379.cpp:49:44: error: template argument for template type parameter must be a type
     constexpr time_point(const time_point<clock, Duration2>& t);
                                           ^~~~~
p1379.cpp:16:18: note: template parameter is declared here
  template<class Clock, class Duration = typename Clock::duration>
                 ^
p1379.cpp:49:16: error: deduction guide must be declared in the same scope as template 'std::chrono::time_point'
     constexpr time_point(const time_point<clock, Duration2>& t);
               ^
p1379.cpp:17:9: note: template is declared here
  class time_point {
        ^
p1379.cpp:49:16: error: deduction guide cannot be declared 'constexpr'
     constexpr time_point(const time_point<clock, Duration2>& t);
     ~~~~~~~~~ ^
p1379.cpp:49:16: error: deduction guide declaration without trailing return type
p1379.cpp:52:11: error: unknown type name 'duration'
constexpr duration time_since_epoch() const;
          ^
p1379.cpp:52:39: error: non-member function cannot have 'const' qualifier
constexpr duration time_since_epoch() const;
                                      ^~~~~
p1379.cpp:55:11: error: unknown type name 'time_point'
constexpr time_point& operator++();
          ^
p1379.cpp:57:11: error: unknown type name 'time_point'
constexpr time_point operator++(int);
          ^
p1379.cpp:59:11: error: unknown type name 'time_point'
constexpr time_point& operator--();
          ^
p1379.cpp:61:11: error: unknown type name 'time_point'
constexpr time_point operator--(int);
          ^
p1379.cpp:63:11: error: unknown type name 'time_point'
constexpr time_point& operator+=(const duration& d);
          ^
p1379.cpp:63:40: error: unknown type name 'duration'
constexpr time_point& operator+=(const duration& d);
                                       ^
p1379.cpp:65:11: error: unknown type name 'time_point'
constexpr time_point& operator-=(const duration& d);
          ^
p1379.cpp:65:40: error: unknown type name 'duration'
constexpr time_point& operator-=(const duration& d);
                                       ^
p1379.cpp:68:18: error: unknown type name 'time_point'
static constexpr time_point min() noexcept;
                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1379.cpp -std=03 -o p1379g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1379.cpp:10:
/usr/local/include/c++/12.1.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.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
p1379.cpp:27:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   27 | constexpr time_point();
      | ^~~~~~~~~
p1379.cpp:42:35: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   42 | static constexpr time_point min() noexcept; static constexpr time_point max() noexcept;
      |                                   ^~~~~~~~
p1379.cpp:19:11: error: expected nested-name-specifier before 'clock'
   19 |     using clock    = Clock;
      |           ^~~~~
p1379.cpp:20:11: error: expected nested-name-specifier before 'duration'
   20 |     using duration = Duration;
      |           ^~~~~~~~
p1379.cpp:21:9: error: expected nested-name-specifier before 'rep'
   21 |   using rep = typename duration::rep;
      |         ^~~
p1379.cpp:22:9: error: expected nested-name-specifier before 'period'
   22 |   using period = typename duration::period;
      |         ^~~~~~
p1379.cpp:24:3: error: 'duration' does not name a type; did you mean 'Duration'?
   24 |   duration d_;
      |   ^~~~~~~~
      |   Duration
p1379.cpp:27:1: error: 'constexpr' does not name a type
   27 | constexpr time_point();
      | ^~~~~~~~~
p1379.cpp:27:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:28:1: error: 'constexpr' does not name a type
   28 | constexpr explicit time_point(const duration& d); template<class Duration2>
      | ^~~~~~~~~
p1379.cpp:28:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:32:7: error: 'constexpr' does not name a type
   32 |       constexpr time_point(const time_point<clock, Duration2>& t);
      |       ^~~~~~~~~
p1379.cpp:32:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:34:1: error: 'constexpr' does not name a type
   34 | constexpr duration time_since_epoch() const;
      | ^~~~~~~~~
p1379.cpp:34:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:36:1: error: 'constexpr' does not name a type
   36 | constexpr time_point& operator++();
      | ^~~~~~~~~
p1379.cpp:36:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:37:1: error: 'constexpr' does not name a type
   37 | constexpr time_point operator++(int);
      | ^~~~~~~~~
p1379.cpp:37:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:38:1: error: 'constexpr' does not name a type
   38 | constexpr time_point& operator--();
      | ^~~~~~~~~
p1379.cpp:38:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:39:1: error: 'constexpr' does not name a type
   39 | constexpr time_point operator--(int);
      | ^~~~~~~~~
p1379.cpp:39:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:40:1: error: 'constexpr' does not name a type
   40 | constexpr time_point& operator+=(const duration& d); constexpr time_point& operator-=(const duration& d);
      | ^~~~~~~~~
p1379.cpp:40:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:40:54: error: 'constexpr' does not name a type
   40 | constexpr time_point& operator+=(const duration& d); constexpr time_point& operator-=(const duration& d);
      |                                                      ^~~~~~~~~
p1379.cpp:40:54: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:42:8: error: 'constexpr' does not name a type
   42 | static constexpr time_point min() noexcept; static constexpr time_point max() noexcept;
      |        ^~~~~~~~~
p1379.cpp:42:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:42:52: error: 'constexpr' does not name a type
   42 | static constexpr time_point min() noexcept; static constexpr time_point max() noexcept;
      |                                                    ^~~~~~~~~
p1379.cpp:42:52: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:45:1: error: expected unqualified-id before '[' token
   45 | [time.point.cons]
      | ^
p1379.cpp:49:6: error: 'constexpr' does not name a type
   49 |      constexpr time_point(const time_point<clock, Duration2>& t);
      |      ^~~~~~~~~
p1379.cpp:49:6: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:52:1: error: 'constexpr' does not name a type
   52 | constexpr duration time_since_epoch() const;
      | ^~~~~~~~~
p1379.cpp:52:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:55:1: error: 'constexpr' does not name a type
   55 | constexpr time_point& operator++();
      | ^~~~~~~~~
p1379.cpp:55:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:57:1: error: 'constexpr' does not name a type
   57 | constexpr time_point operator++(int);
      | ^~~~~~~~~
p1379.cpp:57:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:59:1: error: 'constexpr' does not name a type
   59 | constexpr time_point& operator--();
      | ^~~~~~~~~
p1379.cpp:59:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:61:1: error: 'constexpr' does not name a type
   61 | constexpr time_point operator--(int);
      | ^~~~~~~~~
p1379.cpp:61:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:63:1: error: 'constexpr' does not name a type
   63 | constexpr time_point& operator+=(const duration& d);
      | ^~~~~~~~~
p1379.cpp:63:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:65:1: error: 'constexpr' does not name a type
   65 | constexpr time_point& operator-=(const duration& d);
      | ^~~~~~~~~
p1379.cpp:65:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:68:8: error: 'constexpr' does not name a type
   68 | static constexpr time_point min() noexcept;
      |        ^~~~~~~~~
p1379.cpp:68:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:73:3: error: 'constexpr' does not name a type
   73 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |   ^~~~~~~~~
p1379.cpp:73:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:77:3: error: 'constexpr' does not name a type
   77 |   constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
      |   ^~~~~~~~~
p1379.cpp:77:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:81:3: error: 'constexpr' does not name a type
   81 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |   ^~~~~~~~~
p1379.cpp:81:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:87:3: error: 'constexpr' does not name a type
   87 |   constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:87:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:91:30: error: 'time_point' does not name a type; did you mean 'time_t'?
   91 |                        const time_point<Clock, Duration2>& rhs);
      |                              ^~~~~~~~~~
      |                              time_t
p1379.cpp:94:3: error: 'constexpr' does not name a type
   94 |   constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:94:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:98:3: error: 'constexpr' does not name a type
   98 |   constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:98:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:102:3: error: 'constexpr' does not name a type
  102 |   constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:102:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:106:3: error: 'constexpr' does not name a type
  106 |   constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:106:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:110:10: error: 'three_way_comparable_with' has not been declared
  110 |          three_way_comparable_with<Duration1> Duration2>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:110:35: error: expected '>' before '<' token
  110 |          three_way_comparable_with<Duration1> Duration2>
      |                                   ^
p1379.cpp:111:3: error: 'constexpr' does not name a type
  111 |   constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs,
      |   ^~~~~~~~~
p1379.cpp:111:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:116:3: error: 'constexpr' does not name a type
  116 |   constexpr time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
      |   ^~~~~~~~~
p1379.cpp:116:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:118:3: error: 'time_point' does not name a type; did you mean 'time_t'?
  118 |   time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
      |   ^~~~~~~~~~
      |   time_t
p1379.cpp:124:3: error: 'constexpr' does not name a type
  124 |   constexpr time_point<Clock, ToDuration> ceil(const time_point<Clock, Duration>& tp);
      |   ^~~~~~~~~
p1379.cpp:124:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1379.cpp:128:6: error: 'constexpr' does not name a type
  128 |      constexpr time_point<Clock, ToDuration> round(const time_point<Clock, Duration>& tp);
      |      ^~~~~~~~~
p1379.cpp:128:6: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'

$ g++ p1379.cpp -std=2b -o p1379g -I. -Wall
p1379.cpp:45:1: error: expected unqualified-id before '[' token
   45 | [time.point.cons]
      | ^
p1379.cpp:49:33: error: 'time_point' does not name a type; did you mean 'time_t'?
   49 |      constexpr time_point(const time_point<clock, Duration2>& t);
      |                                 ^~~~~~~~~~
      |                                 time_t
p1379.cpp:49:43: error: expected ',' or '...' before '<' token
   49 |      constexpr time_point(const time_point<clock, Duration2>& t);
      |                                           ^
p1379.cpp:49:16: error: ISO C++ forbids declaration of 'time_point' with no type [-fpermissive]
   49 |      constexpr time_point(const time_point<clock, Duration2>& t);
      |                ^~~~~~~~~~
p1379.cpp:52:11: error: 'duration' does not name a type
   52 | constexpr duration time_since_epoch() const;
      |           ^~~~~~~~
p1379.cpp:55:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   55 | constexpr time_point& operator++();
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:57:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   57 | constexpr time_point operator++(int);
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:59:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   59 | constexpr time_point& operator--();
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:61:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   61 | constexpr time_point operator--(int);
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:63:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   63 | constexpr time_point& operator+=(const duration& d);
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:65:11: error: 'time_point' does not name a type; did you mean 'time_t'?
   65 | constexpr time_point& operator-=(const duration& d);
      |           ^~~~~~~~~~
      |           time_t
p1379.cpp:68:18: error: 'time_point' does not name a type; did you mean 'time_t'?
   68 | static constexpr time_point min() noexcept;
      |                  ^~~~~~~~~~
      |                  time_t
p1379.cpp:73:56: error: 'duration' was not declared in this scope; did you mean 'Duration1'?
   73 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |                                                        ^~~~~~~~
      |                                                        Duration1
p1379.cpp:73:78: error: template argument 2 is invalid
   73 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |                                                                              ^~
p1379.cpp:73:13: error: 'time_point<Clock, <expression error> >' does not name a type
   73 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:77:45: error: 'duration' was not declared in this scope; did you mean 'Duration2'?
   77 |   constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
      |                                             ^~~~~~~~
      |                                             Duration2
p1379.cpp:77:67: error: template argument 1 is invalid
   77 |   constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
      |                                                                   ^
p1379.cpp:77:13: error: 'time_point<Clock, <expression error>, Duration2>' does not name a type
   77 |   constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:81:56: error: 'duration' was not declared in this scope; did you mean 'Duration1'?
   81 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |                                                        ^~~~~~~~
      |                                                        Duration1
p1379.cpp:81:78: error: template argument 2 is invalid
   81 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |                                                                              ^~
p1379.cpp:81:13: error: 'time_point<Clock, <expression error> >' does not name a type
   81 |   constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:87:35: error: 'time_point<Clock, Duration1>' does not name a type
   87 |   constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:88:1: error: expected identifier before 'template'
   88 | template<class Clock, class Duration1, class Duration2>
      | ^~~~~~~~
p1379.cpp:88:1: error: expected ',' or '...' before 'template'
p1379.cpp:90:96: error: expected ')' before ';' token
   90 |     operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
      |                                                                                                ^
      |                                                                                                )
p1379.cpp:87:28: note: to match this '('
   87 |   constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
      |                            ^
p1379.cpp:87:18: error: 'constexpr bool operator==(const int&, int)' must have an argument of class or enumerated type
   87 |   constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:91:41: error: 'Clock' was not declared in this scope; did you mean 'clock'?
   91 |                        const time_point<Clock, Duration2>& rhs);
      |                                         ^~~~~
      |                                         clock
p1379.cpp:91:48: error: 'Duration2' was not declared in this scope
   91 |                        const time_point<Clock, Duration2>& rhs);
      |                                                ^~~~~~~~~
p1379.cpp:91:30: error: 'time_point<<expression error>, <expression error> >' does not name a type
   91 |                        const time_point<Clock, Duration2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:94:34: error: 'time_point<Clock, Duration1>' does not name a type
   94 |   constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:95:29: error: 'time_point<Clock, Duration2>' does not name a type
   95 |                       const time_point<Clock, Duration2>& rhs);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:94:18: error: 'constexpr bool operator<(const int&, const int&)' must have an argument of class or enumerated type
   94 |   constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:98:34: error: 'time_point<Clock, Duration1>' does not name a type
   98 |   constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:100:7: error: 'time_point<Clock, Duration2>' does not name a type
  100 | const time_point<Clock, Duration2>& rhs);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:98:18: error: 'constexpr bool operator>(const int&, const int&)' must have an argument of class or enumerated type
   98 |   constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:102:35: error: 'time_point<Clock, Duration1>' does not name a type
  102 |   constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:103:30: error: 'time_point<Clock, Duration2>' does not name a type
  103 |                        const time_point<Clock, Duration2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:102:18: error: 'constexpr bool operator<=(const int&, const int&)' must have an argument of class or enumerated type
  102 |   constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:106:35: error: 'time_point<Clock, Duration1>' does not name a type
  106 |   constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:107:30: error: 'time_point<Clock, Duration2>' does not name a type
  107 |                        const time_point<Clock, Duration2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:106:18: error: 'constexpr bool operator>=(const int&, const int&)' must have an argument of class or enumerated type
  106 |   constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:111:36: error: 'time_point<Clock, Duration1>' does not name a type
  111 |   constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs,
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:112:36: error: 'time_point<Clock, Duration2>' does not name a type
  112 |                              const time_point<Clock, Duration2>& rhs);
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:111:18: error: 'constexpr auto operator<=>(const int&, const int&)' must have an argument of class or enumerated type
  111 |   constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs,
      |                  ^~~~~~~~
p1379.cpp:116:13: error: 'time_point<Clock, ToDuration>' does not name a type
  116 |   constexpr time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:118:14: error: 'Clock' was not declared in this scope; did you mean 'clock'?
  118 |   time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
      |              ^~~~~
      |              clock
p1379.cpp:118:21: error: 'ToDuration' was not declared in this scope
  118 |   time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
      |                     ^~~~~~~~~~
p1379.cpp:118:47: error: 'ToDuration' was not declared in this scope
  118 |   time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
      |                                               ^~~~~~~~~~
p1379.cpp:118:3: error: specializing member '::time_point<<expression error>, <expression error> >' requires 'template<>' syntax
  118 |   time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:124:13: error: 'time_point<Clock, ToDuration>' does not name a type
  124 |   constexpr time_point<Clock, ToDuration> ceil(const time_point<Clock, Duration>& tp);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1379.cpp:128:16: error: 'time_point<Clock, ToDuration>' does not name a type
  128 |      constexpr time_point<Clock, ToDuration> round(const time_point<Clock, Duration>& tp);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

# 検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

<!-- リンクエラーの解説をする。clang++とg++の比較。意味のある出力。
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。-->

## 応用例1　AUTOSAR C++

AUTOSARでC++のコーディング標準を作っている。　
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。　


Autosar Guidelines C++14 example code compile list


https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76

## 応用例2　MISRA C++

MISRA C++, AUTOSAR C++について

https://qiita.com/kaizen_nagoya/items/3436fbd49865e0da7d35

MISRA C++ 5-0-16

https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74


## 応用例3 CERT C++

MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする

https://qiita.com/kaizen_nagoya/items/8dff19511e42b2593db1

## 応用例4 箱庭　

箱庭ではUnityをはじめC++を使っているらしい。　

ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。

仮想戦略会議「箱庭」

https://qiita.com/kaizen_nagoya/items/73cb132707653176a461

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる（１）

https://qiita.com/kaizen_nagoya/items/a22bf2b1dab0ad3258d4

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる（2）

https://qiita.com/kaizen_nagoya/items/e3c0ceb2dcc9cf3f3fac


# 参考資料(reference)

エンジニア夏休み企画 個人開発

https://qiita.com/official-events/6d31965c499a69377c0b


## 自己参考資料(self reference)

関連する自己参照以外は、こちらの先頭に移転。

C言語（C++)に対する誤解、曲解、無理解、爽快。

https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

#include "N4910.h"

https://qiita.com/kaizen_nagoya/items/163a47cef7d6bb1c33a8

C++N4910資料の改善点

https://qiita.com/kaizen_nagoya/items/fb4ceb5d117a54641af3

dockerにclang

https://qiita.com/kaizen_nagoya/items/8829ffeee397eda50e80

docker gnu(gcc/g++) and llvm(clang/clang++)

https://qiita.com/kaizen_nagoya/items/059874ea39c4de64c0f7

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da


C++N4910:2022 tag follower 300人超えました。ありがとうございます。

https://qiita.com/kaizen_nagoya/items/a63fb96d351ac5c16ff7

astyle 使ってみた

https://qiita.com/kaizen_nagoya/items/3c9a87a781d53a1a23f3

【個人開発】　効率的な背景　＜エンジニア夏休み企画＞

https://qiita.com/kaizen_nagoya/items/3ebab436e63731e4b885

 ＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞

# 文書履歴(document history)
ver. 0.01 初稿 　20220820