LoginSignup
0
0

More than 1 year has passed since last update.

29.5 Class template duration [time.duration] C++N4910:2022 (673) p1372.cpp

Posted at

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

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++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

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

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

コンパイラの実装状況

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

作業方針(sequence)

Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、

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

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

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

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list

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++

編纂器(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.5 Class template duration [time.duration] C++N4910:2022 (673) p1372.cpp

算譜(source code)

p1372.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.5 Class template duration [time.duration] C++N4910:2022 (673) p1372.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.5.1 General [time.duration.general]
// A duration type measures time between two points in time (time_points). A duration has a representation which holds a count of ticks and a tick period. The tick period is the amount of time which occurs from one tick to the next, in units of seconds. It is expressed as a rational constant using the template ratio.
namespace std::chrono {
template<class Rep, class Period = ratio<1>>
class duration {
public:
    using rep    = Rep;
    using period = typename Period::type;
private:
    rep rep_; // exposition only
public:
// 29.5.2, construct/copy/destroy
    constexpr duration() = default;
    template<class Rep2>
    constexpr explicit duration(const Rep2& r);
    template<class Rep2, class Period2>
    constexpr duration(const duration<Rep2, Period2>& d);
    ~duration() = default;
    duration(const duration&) = default;
    duration& operator=(const duration&) = default;
// 29.5.3, observer
    constexpr rep count() const;
// 29.5.4, arithmetic
    constexpr common_type_t<duration> operator+() const;
    constexpr common_type_t<duration> operator-() const;
    constexpr duration& operator++();
    constexpr duration operator++(int);
    constexpr duration& operator--();
    constexpr duration operator--(int);
    constexpr duration& operator+=(const duration& d);
    constexpr duration& operator-=(const duration& d);
// — the expression T::now() is well-formed when treated as an unevaluated operand. 2 The behavior of a program that adds specializations for is_clock is undefined.
// 29.5 Class template duration [time.duration]
// 29.5.1 General [time.duration.general]
// Constraints: is_convertible_v<const Rep2&, rep> is true and — treat_as_floating_point_v<rep> is true or
// — treat_as_floating_point_v<Rep2> is false.
// Effects: Initializes rep_ with duration_cast<duration>(d).count().
    constexpr duration& operator*=(const rep& rhs);
    constexpr duration& operator/=(const rep& rhs);
    constexpr duration& operator%=(const rep& rhs);
    constexpr duration& operator%=(const duration& rhs);
// 29.5.5, special values
    static constexpr duration zero() noexcept;
    static constexpr duration min() noexcept;
    static constexpr duration max() noexcept;
};
}
//  Rep shall be an arithmetic type or a class emulating an arithmetic type. If duration is instantiated with a duration type as the argument for the template parameter Rep, the program is ill-formed.
//  If Period is not a specialization of ratio, the program is ill-formed. If Period::num is not positive, the program is ill-formed.
//  Members of duration do not throw exceptions other than those thrown by the indicated operations on their representations.
//  The defaulted copy constructor of duration shall be a constexpr function if and only if the required initialization of the member rep_ for copy and move, respectively, would satisfy the requirements for a constexpr function.
//  [Example 1 :
duration<long, ratio<60>> d0; // holds a count of minutes using a long
duration<long long, milli> d1; // holds a count of milliseconds using a long long
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
// 29.5.2 Constructors [time.duration.cons]
template<class Rep2>
constexpr explicit duration(const Rep2& r);
// [Example 1:
duration<int, milli> d(3);
duration<int, milli> d(3.5);
// Effects: Initializes rep_ with r.
// OK // error
template<class Rep2, class Period2>
constexpr duration(const duration<Rep2, Period2>& d);
// (30 Hz) using a double
// Constraints: No overflow is induced in the conversion and treat_as_floating_point_v<rep> is true or both ratio_divide<Period2, period>::den is 1 and treat_as_floating_point_v<Rep2> is false.
// [Note 1: This requirement prevents implicit truncation error when converting between integral-based duration types. Such a construction could easily lead to confusion about the value of the duration.
// [Example 2:
duration<int, milli> ms(3);
duration<int, micro> us = ms;
duration<int, milli> ms2 = us;
// OK // error
// 29.5.3 Observer [time.duration.observer]
constexpr rep count() const;
// Returns: rep_.
// 29.5.4 Arithmetic [time.duration.arithmetic]
constexpr common_type_t<duration> operator+() const;
// Returns: common_type_t<duration>(*this).
constexpr common_type_t<duration> operator-() const;
// Returns: common_type_t<duration>(-rep_).
constexpr duration& operator++();
// Effects: Equivalent to: ++rep_. Returns: *this.
constexpr duration operator++(int);
// Effects: Equivalent to: return duration(rep_++);
constexpr duration& operator--();
// Effects: Equivalent to: --rep_. Returns: *this.
constexpr duration operator--(int);
// Effects: Equivalent to: return duration(rep_--);
constexpr duration& operator+=(const duration& d);
// Effects: Equivalent to: rep_ += d.count(). Returns: *this.
constexpr duration& operator-=(const duration& d);
// Effects: Equivalent to: rep_ -= d.count(). Returns: *this.
constexpr duration& operator*=(const rep& rhs);
// Effects: Equivalent to: rep_ *= rhs. Returns: *this.
constexpr duration& operator/=(const rep& rhs);
// Effects: Equivalent to: rep_ /= rhs. Returns: *this.
constexpr duration& operator%=(const rep& rhs);
// Effects: Equivalent to: rep_ %= rhs. Returns: *this.
constexpr duration& operator%=(const duration& rhs);
// Effects: Equivalent to: rep_ %= rhs.count(). Returns: *this.
// 29.5.5 Special values [time.duration.special]
static constexpr duration zero() noexcept;
// Returns: duration(duration_values<rep>::zero()).
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// Returns: CD(CD(lhs).count() + CD(rhs).count()).
static constexpr duration min() noexcept;
// Returns: duration(duration_values<rep>::min()). static constexpr duration max() noexcept;
// Returns: duration(duration_values<rep>::max()).
// 29.5.6 Non-member arithmetic [time.duration.nonmember]
//  In the function descriptions that follow, unless stated otherwise, let CD represent the return type of the function.
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
        template<class Rep1, class Period1, class Rep2, class Period2>
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
        operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// Returns: CD(CD(lhs).count() - CD(rhs).count()).
template<class Rep1, class Period, class Rep2>
constexpr duration<common_type_t<Rep1, Rep2>, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s);
// Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true. Returns: CD(CD(d).count() * s).
template<class Rep1, class Rep2, class Period>
constexpr duration<common_type_t<Rep1, Rep2>, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d);
// Constraints: is_convertible_v<const Rep1&, common_type_t<Rep1, Rep2>> is true. Returns: d * s.
template<class Rep1, class Period, class Rep2>
constexpr duration<common_type_t<Rep1, Rep2>, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s);
// Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration.
// Returns: CD(CD(d).count() / s).
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr common_type_t<Rep1, Rep2>
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// Let CD be common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>. Returns: CD(lhs).count() / CD(rhs).count().
template<class Rep1, class Period, class Rep2>
constexpr duration<common_type_t<Rep1, Rep2>, Period>
operator%(const duration<Rep1, Period>& d, const Rep2& s);
// Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration.
// Returns: CD(CD(d).count() % s).
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
        operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// Returns: CD(CD(lhs).count() % CD(rhs).count()).
const duration<Rep2, Period2>& rhs);
// Returns: CT(lhs).count() == CT(rhs).count().
// 29.5.7 Comparisons [time.duration.comparisons]
//  In the function descriptions that follow, CT represents common_type_t<A, B>, where A and B are the types of the two arguments to the function.
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator==(const duration<Rep1, Period1>& lhs,
          template<class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator<(const duration<Rep1, Period1>& lhs,
                         const duration<Rep2, Period2>& rhs);
// Returns: CT(lhs).count() < CT(rhs).count().
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator>(const duration<Rep1, Period1>& lhs,
// Returns: rhs < lhs.
                         const duration<Rep2, Period2>& rhs);
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
                          const duration<Rep2, Period2>& rhs);
// Returns: !(rhs < lhs).
template<class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
                          const duration<Rep2, Period2>& rhs);
// Returns: !(lhs < rhs).
template<class Rep1, class Period1, class Rep2, class Period2>
requires three_way_comparable<typename CT::rep>
constexpr auto operator<=>(const duration<Rep1, Period1>& lhs,
                           const duration<Rep2, Period2>& rhs);
// Returns: CT(lhs).count() <=> CT(rhs).count().
// 29.5.8 Conversions
template<class ToDuration, class Rep, class Period>
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
// [time.duration.cast]
// Constraints: ToDuration is a specialization of duration.
// Returns: Let CF be ratio_divide<Period, typename ToDuration::period>, and CR be common_-
type<typename ToDuration::rep, Rep, intmax_t>::type.  If CF::num == 1 and CF::den == 1, returns
ToDuration(static_cast<typename ToDuration::rep>(d.count()))
// — otherwise, if CF::num != 1 and CF::den == 1, returns
ToDuration(static_cast<typename ToDuration::rep>(
               static_cast<CR>(d.count()) * static_cast<CR>(CF::num)))
// — otherwise, if CF::num == 1 and CF::den != 1, returns
ToDuration(static_cast<typename ToDuration::rep>(
               static_cast<CR>(d.count()) / static_cast<CR>(CF::den)))
// — otherwise, returns
ToDuration(static_cast<typename ToDuration::rep>(
               static_cast<CR>(d.count()) * static_cast<CR>(CF::num) / static_cast<CR>(CF::den)))
// [Note 1: This function does not use any implicit conversions; all conversions are done with static_cast. It avoids multiplications and divisions when it is known at compile time that one or more arguments is //  Intermediate computations are carried out in the widest representation and only converted to the destination representation at the final step.
// Returns: A duration literal representing sec seconds.
// [Note 1: The same suffix s is used for basic_string but there is no conflict, since duration suffixes apply to
template<class ToDuration, class Rep, class Period>
constexpr ToDuration floor(const duration<Rep, Period>& d);
//  This subclause describes literal suffixes for constructing duration literals. The suffixes h, min, s, ms, us, ns denote duration values of the corresponding types hours, minutes, seconds, milliseconds, microseconds, and nanoseconds respectively if they are applied to integer-literals.
//  If any of these suffixes are applied to a floating-point-literal the result is a chrono::duration literal with an unspecified floating-point representation.
//  If any of these suffixes are applied to an integer-literal and the resulting chrono::duration value cannot be represented in the result type because of overflow, the program is ill-formed.
//  [Example 1: The following code shows some duration literals.
using namespace std::chrono_literals;
auto constexpr aday=24h;
auto constexpr lesson=45min;
auto constexpr halfanhour=0.5h;
// Returns: A duration literal representing hours hours.
constexpr chrono::minutes operator""min(unsigned long long minutes);
constexpr chrono::duration<unspecified, ratio<60, 1>> operator""min(long double minutes);
// Returns: A duration literal representing minutes minutes.
constexpr chrono::seconds operator""s(unsigned long long sec); constexpr chrono::duration<unspecified> operator""s(long double sec);
// Constraints: ToDuration is a specialization of duration.
// Returns: The greatest result t representable in ToDuration for which t <= d.
template<class ToDuration, class Rep, class Period>
constexpr ToDuration ceil(const duration<Rep, Period>& d);
// Constraints: ToDuration is a specialization of duration.
// Returns: The least result t representable in ToDuration for which t >= d.
template<class ToDuration, class Rep, class Period>
constexpr ToDuration round(const duration<Rep, Period>& d);
// Constraints: ToDuration is a specialization of duration and treat_as_floating_point_v<typename ToDuration::rep> is false.
// Returns: The value of ToDuration that is closest to d. If there are two closest values, then return the valuetforwhicht % 2 == 0.
// 29.5.9 Suffixes for duration literals [time.duration.literals]
constexpr chrono::hours
operator""h(unsigned long long hours);
constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
// numbers and string literal suffixes apply to character array literals.
constexpr chrono::milliseconds operator""ms(unsigned long long msec);
constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
// Returns: A duration literal representing msec milliseconds.
constexpr chrono::microseconds operator""us(unsigned long long usec); constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
// Returns: A duration literal representing usec microseconds.
constexpr chrono::nanoseconds operator""ns(unsigned long long nsec);
constexpr chrono::duration<unspecified, nano> operator""ns(long double nsec);
// Returns: A duration literal representing nsec nanoseconds.
// 29.5.10 Algorithms [time.duration.alg]
template<class Rep, class Period>
constexpr duration<Rep, Period> abs(duration<Rep, Period> d);
// Constraints: numeric_limits<Rep>::is_signed is true. Returns: If d >= d.zero(), return d, otherwise return -d.
// 29.5.11 I/O [time.duration.io]
template<class charT, class traits, class Rep, class Period>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
// Effects: Inserts the duration d onto the stream os as if it were implemented as follows:
basic_ostringstream<charT, traits> s;
s.flags(os.flags());
s.imbue(os.getloc());
s.precision(os.precision());
s << d.count() << units-suffix;
return os << s.str();
// where units-suffix depends on the type Period::type as follows:
// — If Period::type is atto, units-suffix is "as".
// — Otherwise, if Period::type is femto, units-suffix is "fs".
// — Otherwise, if Period::type is pico, units-suffix is "ps".
// — Otherwise, if Period::type is nano, units-suffix is "ns".
// — Otherwise, if Period::type is micro, it is implementation-defined whether units-suffix is "μs" ("\u00b5\u0073") or "us".
// — Otherwise, if Period::type is milli, units-suffix is "ms".
// — Otherwise, if Period::type is centi, units-suffix is "cs".
// — Otherwise, if Period::type is deci, units-suffix is "ds".
// — Otherwise, if Period::type is ratio<1>, units-suffix is "s".
// — Otherwise, if Period::type is deca, units-suffix is "das".
// — Otherwise, if Period::type is hecto, units-suffix is "hs".
// — Otherwise, if Period::type is kilo, units-suffix is "ks".
// — Otherwise, if Period::type is mega, units-suffix is "Ms".
// — Otherwise, if Period::type is giga, units-suffix is "Gs".
// — Otherwise, if Period::type is tera, units-suffix is "Ts".
// — Otherwise, if Period::type is peta, units-suffix is "Ps".
// — Otherwise, if Period::type is exa, units-suffix is "Es".
// — Otherwise, if Period::type is ratio<60>, units-suffix is "min".
// — Otherwise, if Period::type is ratio<3600>, units-suffix is "h".
// — Otherwise, if Period::type is ratio<86400>, units-suffix is "d".
// — Otherwise, if Period::type::den == 1, units-suffix is "[num ]s".
// — Otherwise, units-suffix is "[num /den ]s". In the list above, the use of num and den refer to the static data members of Period::type, which are converted to arrays of charT using a decimal conversion with no leading zeroes.
// Returns: os.
template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
basic_istream<charT, traits>&
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
            duration<Rep, Period>& d,
            basic_string<charT, traits, Alloc>* abbrev = nullptr,
            minutes* offset = nullptr);
// Effects: Attempts to parse the input stream is into the duration d using the format flags given in the NTCTS fmt as specified in 29.13. If the parse fails to decode a valid duration, is.setstate(ios_- base::failbit) is called and d is not modified. If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null.
// Effects: Initializes d_ with duration::zero(). Such a time_point object represents the epoch. constexpr explicit time_point(const duration& d);
// Returns: is.
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1372.cpp -std=03 -o p1372l -I. -Wall
In file included from p1372.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 \
 ^
p1372.cpp:16:21: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
       namespace std::chrono {
                    ^~~~~~~~
                     { namespace chrono
p1372.cpp:18:10: error: expected expression
         class duration {
         ^
p1372.cpp:56:2: error: expected '>'
}; }
 ^
p1372.cpp:17:50: note: to match this '<'
         template<class Rep, class Period = ratio<1>>
                                                 ^
p1372.cpp:56:2: error: expected ',' or '>' in template-parameter-list
}; }
 ^
p1372.cpp:56:2: error: declaration does not declare anything
p1372.cpp:62:24: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11 [-Wc++11-compat]
duration<long, ratio<60>> d0; // holds a count of minutes using a long
                       ^
                     (      )
p1372.cpp:62:27: error: use of undeclared identifier 'd0'
duration<long, ratio<60>> d0; // holds a count of minutes using a long
                          ^
p1372.cpp:62:29: error: expected '>'
duration<long, ratio<60>> d0; // holds a count of minutes using a long
                            ^
p1372.cpp:62:21: note: to match this '<'
duration<long, ratio<60>> d0; // holds a count of minutes using a long
                    ^
p1372.cpp:62:29: error: expected a type
duration<long, ratio<60>> d0; // holds a count of minutes using a long
                            ^
p1372.cpp:62:29: error: expected '>'
p1372.cpp:62:9: note: to match this '<'
duration<long, ratio<60>> d0; // holds a count of minutes using a long
        ^
p1372.cpp:63:21: error: use of undeclared identifier 'milli'
duration<long long, milli> d1; // holds a count of milliseconds using a long long 
                    ^
p1372.cpp:64:29: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11 [-Wc++11-compat]
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                            ^
                          (      )
p1372.cpp:64:32: error: use of undeclared identifier 'd2'
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                               ^
p1372.cpp:64:34: error: expected '>'
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                                 ^
p1372.cpp:64:23: note: to match this '<'
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                      ^
p1372.cpp:64:34: error: expected a type
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                                 ^
p1372.cpp:64:34: error: expected '>'
p1372.cpp:64:9: note: to match this '<'
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
        ^
p1372.cpp:67:3: error: unknown type name 'constexpr'
  constexpr explicit duration(const Rep2& r);
  ^
p1372.cpp:69:15: error: use of undeclared identifier 'milli'
duration<int, milli> d(3);
              ^
p1372.cpp:70:17: error: use of undeclared identifier 'milli'
  duration<int, milli> d(3.5);
                ^
p1372.cpp:74:3: error: unknown type name 'constexpr'
  constexpr duration(const duration<Rep2, Period2>& d);
  ^
p1372.cpp:74:28: error: parameter name cannot have template arguments
  constexpr duration(const duration<Rep2, Period2>& d);
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
$ clang++ p1372.cpp -std=2b -o p1372l -I. -Wall
p1372.cpp:17:45: error: no template named 'ratio'
         template<class Rep, class Period = ratio<1>>
                                            ^
p1372.cpp:62:16: error: use of undeclared identifier 'ratio'
duration<long, ratio<60>> d0; // holds a count of minutes using a long
               ^
p1372.cpp:63:21: error: use of undeclared identifier 'milli'
duration<long long, milli> d1; // holds a count of milliseconds using a long long 
                    ^
p1372.cpp:64:18: error: use of undeclared identifier 'ratio'
duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
                 ^
p1372.cpp:67:22: error: no template named 'duration'; did you mean 'std::chrono::duration'?
  constexpr explicit duration(const Rep2& r);
                     ^~~~~~~~
                     std::chrono::duration
p1372.cpp:18:16: note: 'std::chrono::duration' declared here
         class duration {
               ^
p1372.cpp:67:22: error: deduction guide must be declared in the same scope as template 'std::chrono::duration'
  constexpr explicit duration(const Rep2& r);
                     ^
p1372.cpp:18:16: note: template is declared here
         class duration {
               ^
p1372.cpp:67:22: error: deduction guide cannot be declared 'constexpr'
  constexpr explicit duration(const Rep2& r);
  ~~~~~~~~~          ^
p1372.cpp:67:22: error: deduction guide declaration without trailing return type
p1372.cpp:69:15: error: use of undeclared identifier 'milli'
duration<int, milli> d(3);
              ^
p1372.cpp:70:17: error: use of undeclared identifier 'milli'
  duration<int, milli> d(3.5);
                ^
p1372.cpp:74:13: error: no template named 'duration'; did you mean 'std::chrono::duration'?
  constexpr duration(const duration<Rep2, Period2>& d);
            ^~~~~~~~
            std::chrono::duration
p1372.cpp:18:16: note: 'std::chrono::duration' declared here
         class duration {
               ^
p1372.cpp:74:28: error: no template named 'duration'; did you mean 'std::chrono::duration'?
  constexpr duration(const duration<Rep2, Period2>& d);
                           ^~~~~~~~
                           std::chrono::duration
p1372.cpp:18:16: note: 'std::chrono::duration' declared here
         class duration {
               ^
p1372.cpp:74:13: error: deduction guide must be declared in the same scope as template 'std::chrono::duration'
  constexpr duration(const duration<Rep2, Period2>& d);
            ^
p1372.cpp:18:16: note: template is declared here
         class duration {
               ^
p1372.cpp:74:13: error: deduction guide cannot be declared 'constexpr'
  constexpr duration(const duration<Rep2, Period2>& d);
  ~~~~~~~~~ ^
p1372.cpp:74:13: error: deduction guide declaration without trailing return type
p1372.cpp:79:17: error: use of undeclared identifier 'milli'
  duration<int, milli> ms(3);
                ^
p1372.cpp:80:17: error: use of undeclared identifier 'micro'
  duration<int, micro> us = ms;
                ^
p1372.cpp:81:17: error: use of undeclared identifier 'milli'
  duration<int, milli> ms2 = us;
                ^
p1372.cpp:84:11: error: unknown type name 'rep'
constexpr rep count() const;
          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1372.cpp -std=03 -o p1372g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1372.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 \
      |  ^~~~~
p1372.cpp:26:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   26 | constexpr duration() = default; template<class Rep2>
      | ^~~~~~~~~
p1372.cpp:53:34: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   53 | static constexpr duration zero() noexcept;
      |                                  ^~~~~~~~
p1372.cpp:186:54: error: extended character — is not valid in an identifier
  186 | type<typename ToDuration::rep, Rep, intmax_t>::type. — If CF::num == 1 and CF::den == 1, returns
      |                                                      ^
p1372.cpp:207:26: error: invalid suffix "h" on integer constant
  207 |      auto constexpr aday=24h;
      |                          ^~~
p1372.cpp:208:28: error: invalid suffix "min" on integer constant
  208 |      auto constexpr lesson=45min;
      |                            ^~~~~
p1372.cpp:209:32: error: invalid suffix "h" on floating constant
  209 |      auto constexpr halfanhour=0.5h;
      |                                ^~~~
p1372.cpp:281:62: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++11-compat]
  281 |                 basic_string<charT, traits, Alloc>* abbrev = nullptr,
      |                                                              ^~~~~~~
p1372.cpp:17:45: error: 'ratio' does not name a type
   17 |          template<class Rep, class Period = ratio<1>>
      |                                             ^~~~~
p1372.cpp:17:50: error: expected '>' before '<' token
   17 |          template<class Rep, class Period = ratio<1>>
      |                                                  ^
p1372.cpp:18:25: error: expected unqualified-id before '{' token
   18 |          class duration {
      |                         ^
p1372.cpp:62:1: error: 'duration' does not name a type
   62 | duration<long, ratio<60>> d0; // holds a count of minutes using a long
      | ^~~~~~~~
p1372.cpp:63:1: error: 'duration' does not name a type
   63 | duration<long long, milli> d1; // holds a count of milliseconds using a long long
      | ^~~~~~~~
p1372.cpp:64:1: error: 'duration' does not name a type
   64 | duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
      | ^~~~~~~~
p1372.cpp:67:3: error: 'constexpr' does not name a type
   67 |   constexpr explicit duration(const Rep2& r);
      |   ^~~~~~~~~
p1372.cpp:67:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:69:1: error: 'duration' does not name a type
   69 | duration<int, milli> d(3);
      | ^~~~~~~~
p1372.cpp:70:3: error: 'duration' does not name a type
   70 |   duration<int, milli> d(3.5);
      |   ^~~~~~~~
p1372.cpp:74:3: error: 'constexpr' does not name a type
   74 |   constexpr duration(const duration<Rep2, Period2>& d);
      |   ^~~~~~~~~
p1372.cpp:74:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:79:3: error: 'duration' does not name a type
   79 |   duration<int, milli> ms(3);
      |   ^~~~~~~~
p1372.cpp:80:3: error: 'duration' does not name a type
   80 |   duration<int, micro> us = ms;
      |   ^~~~~~~~
p1372.cpp:81:3: error: 'duration' does not name a type
   81 |   duration<int, milli> ms2 = us;
      |   ^~~~~~~~
p1372.cpp:84:1: error: 'constexpr' does not name a type
   84 | constexpr rep count() const;
      | ^~~~~~~~~
p1372.cpp:84:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:87:1: error: 'constexpr' does not name a type
   87 | constexpr common_type_t<duration> operator+() const;
      | ^~~~~~~~~
p1372.cpp:87:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:89:1: error: 'constexpr' does not name a type
   89 | constexpr common_type_t<duration> operator-() const;
      | ^~~~~~~~~
p1372.cpp:89:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:91:1: error: 'constexpr' does not name a type
   91 | constexpr duration& operator++();
      | ^~~~~~~~~
p1372.cpp:91:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:93:1: error: 'constexpr' does not name a type
   93 | constexpr duration operator++(int);
      | ^~~~~~~~~
p1372.cpp:93:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:95:1: error: 'constexpr' does not name a type
   95 | constexpr duration& operator--();
      | ^~~~~~~~~
p1372.cpp:95:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:97:1: error: 'constexpr' does not name a type
   97 | constexpr duration operator--(int);
      | ^~~~~~~~~
p1372.cpp:97:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:99:1: error: 'constexpr' does not name a type
   99 | constexpr duration& operator+=(const duration& d);
      | ^~~~~~~~~
p1372.cpp:99:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:101:1: error: 'constexpr' does not name a type
  101 | constexpr duration& operator-=(const duration& d);
      | ^~~~~~~~~
p1372.cpp:101:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:103:1: error: 'constexpr' does not name a type
  103 | constexpr duration& operator*=(const rep& rhs);
      | ^~~~~~~~~
p1372.cpp:103:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:105:1: error: 'constexpr' does not name a type
  105 | constexpr duration& operator/=(const rep& rhs);
      | ^~~~~~~~~
p1372.cpp:105:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:107:1: error: 'constexpr' does not name a type
  107 | constexpr duration& operator%=(const rep& rhs);
      | ^~~~~~~~~
p1372.cpp:107:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:109:1: error: 'constexpr' does not name a type
  109 | constexpr duration& operator%=(const duration& rhs);
      | ^~~~~~~~~
p1372.cpp:109:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:112:8: error: 'constexpr' does not name a type
  112 | static constexpr duration zero() noexcept;
      |        ^~~~~~~~~
p1372.cpp:112:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:114:17: error: 'duration' does not name a type
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                 ^~~~~~~~
p1372.cpp:114:25: error: expected ',' or '...' before '<' token
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                         ^
p1372.cpp:114:82: error: expected constructor, destructor, or type conversion before ';' token
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                                                  ^
p1372.cpp:116:8: error: 'constexpr' does not name a type
  116 | static constexpr duration min() noexcept;
      |        ^~~~~~~~~
p1372.cpp:116:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:122:6: error: 'constexpr' does not name a type
  122 |      constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
      |      ^~~~~~~~~
p1372.cpp:122:6: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:128:3: error: 'constexpr' does not name a type
  128 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |   ^~~~~~~~~
p1372.cpp:128:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:132:3: error: 'constexpr' does not name a type
  132 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |   ^~~~~~~~~
p1372.cpp:132:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:136:3: error: 'constexpr' does not name a type
  136 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |   ^~~~~~~~~
p1372.cpp:136:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:141:3: error: 'constexpr' does not name a type
  141 |   constexpr common_type_t<Rep1, Rep2>
      |   ^~~~~~~~~
p1372.cpp:141:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:145:3: error: 'constexpr' does not name a type
  145 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |   ^~~~~~~~~
p1372.cpp:145:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:150:3: error: 'constexpr' does not name a type
  150 |   constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
      |   ^~~~~~~~~
p1372.cpp:150:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:153:30: error: 'duration' does not name a type
  153 |                        const duration<Rep2, Period2>& rhs);
      |                              ^~~~~~~~
p1372.cpp:158:3: error: 'constexpr' does not name a type
  158 |   constexpr bool operator==(const duration<Rep1, Period1>& lhs,
      |   ^~~~~~~~~
p1372.cpp:158:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:164:3: error: 'constexpr' does not name a type
  164 |   constexpr bool operator>(const duration<Rep1, Period1>& lhs,
      |   ^~~~~~~~~
p1372.cpp:164:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:168:3: error: 'constexpr' does not name a type
  168 |   constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
      |   ^~~~~~~~~
p1372.cpp:168:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:172:3: error: 'constexpr' does not name a type
  172 |   constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
      |   ^~~~~~~~~
p1372.cpp:172:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:176:3: error: 'requires' does not name a type
  176 |   requires three_way_comparable<typename CT::rep>
      |   ^~~~~~~~
p1372.cpp:176:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p1372.cpp:182:3: error: 'constexpr' does not name a type
  182 |   constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
      |   ^~~~~~~~~
p1372.cpp:182:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:186:1: error: 'type' does not name a type
  186 | type<typename ToDuration::rep, Rep, intmax_t>::type. — If CF::num == 1 and CF::den == 1, returns
      | ^~~~
p1372.cpp:206:27: error: 'chrono_literals' is not a namespace-name
  206 |      using namespace std::chrono_literals;
      |                           ^~~~~~~~~~~~~~~
p1372.cpp:207:6: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  207 |      auto constexpr aday=24h;
      |      ^~~~
      |      ----
p1372.cpp:207:11: error: 'constexpr' does not name a type
  207 |      auto constexpr aday=24h;
      |           ^~~~~~~~~
p1372.cpp:207:11: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:208:6: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  208 |      auto constexpr lesson=45min;
      |      ^~~~
      |      ----
p1372.cpp:208:11: error: 'constexpr' does not name a type
  208 |      auto constexpr lesson=45min;
      |           ^~~~~~~~~
p1372.cpp:208:11: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:209:6: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  209 |      auto constexpr halfanhour=0.5h;
      |      ^~~~
      |      ----
p1372.cpp:209:11: error: 'constexpr' does not name a type
  209 |      auto constexpr halfanhour=0.5h;
      |           ^~~~~~~~~
p1372.cpp:209:11: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:211:1: error: 'constexpr' does not name a type
  211 | constexpr chrono::minutes operator""min(unsigned long long minutes);
      | ^~~~~~~~~
p1372.cpp:211:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:212:1: error: 'constexpr' does not name a type
  212 | constexpr chrono::duration<unspecified, ratio<60, 1>> operator""min(long double minutes);
      | ^~~~~~~~~
p1372.cpp:212:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:214:1: error: 'constexpr' does not name a type
  214 | constexpr chrono::seconds operator""s(unsigned long long sec); constexpr chrono::duration<unspecified> operator""s(long double sec);
      | ^~~~~~~~~
p1372.cpp:214:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:214:64: error: 'constexpr' does not name a type
  214 | constexpr chrono::seconds operator""s(unsigned long long sec); constexpr chrono::duration<unspecified> operator""s(long double sec);
      |                                                                ^~~~~~~~~
p1372.cpp:214:64: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:218:3: error: 'constexpr' does not name a type
  218 |   constexpr ToDuration ceil(const duration<Rep, Period>& d);
      |   ^~~~~~~~~
p1372.cpp:218:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:222:3: error: 'constexpr' does not name a type
  222 |   constexpr ToDuration round(const duration<Rep, Period>& d);
      |   ^~~~~~~~~
p1372.cpp:222:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:226:2: error: 'constexpr' does not name a type
  226 |  constexpr chrono::hours
      |  ^~~~~~~~~
p1372.cpp:226:2: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:228:1: error: 'constexpr' does not name a type
  228 | constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
      | ^~~~~~~~~
p1372.cpp:228:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:230:1: error: 'constexpr' does not name a type
  230 | constexpr chrono::milliseconds operator""ms(unsigned long long msec);
      | ^~~~~~~~~
p1372.cpp:230:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:231:1: error: 'constexpr' does not name a type
  231 | constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
      | ^~~~~~~~~
p1372.cpp:231:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:233:1: error: 'constexpr' does not name a type
  233 | constexpr chrono::microseconds operator""us(unsigned long long usec); constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
      | ^~~~~~~~~
p1372.cpp:233:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:233:71: error: 'constexpr' does not name a type
  233 | constexpr chrono::microseconds operator""us(unsigned long long usec); constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
      |                                                                       ^~~~~~~~~
p1372.cpp:233:71: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:235:1: error: 'constexpr' does not name a type
  235 | constexpr chrono::nanoseconds operator""ns(unsigned long long nsec);
      | ^~~~~~~~~
p1372.cpp:235:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:236:1: error: 'constexpr' does not name a type
  236 | constexpr chrono::duration<unspecified, nano> operator""ns(long double nsec);
      | ^~~~~~~~~
p1372.cpp:236:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:240:3: error: 'constexpr' does not name a type
  240 |   constexpr duration<Rep, Period> abs(duration<Rep, Period> d);
      |   ^~~~~~~~~
p1372.cpp:240:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p1372.cpp:245:52: error: 'duration' does not name a type
  245 | operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
      |                                                    ^~~~~~~~
p1372.cpp:245:60: error: expected ',' or '...' before '<' token
  245 | operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
      |                                                            ^
p1372.cpp:247:24: error: 'charT' was not declared in this scope; did you mean 'char'?
  247 |    basic_ostringstream<charT, traits> s;
      |                        ^~~~~
      |                        char
p1372.cpp:247:31: error: 'traits' was not declared in this scope
  247 |    basic_ostringstream<charT, traits> s;
      |                               ^~~~~~
p1372.cpp:247:37: error: template argument 1 is invalid
  247 |    basic_ostringstream<charT, traits> s;
      |                                     ^
p1372.cpp:247:37: error: template argument 2 is invalid
p1372.cpp:247:37: error: template argument 3 is invalid
p1372.cpp:248:4: error: 's' does not name a type
  248 |    s.flags(os.flags());
      |    ^
p1372.cpp:249:4: error: 's' does not name a type
  249 |    s.imbue(os.getloc());
      |    ^
p1372.cpp:250:4: error: 's' does not name a type
  250 |    s.precision(os.precision());
      |    ^
p1372.cpp:251:1: error: 's' does not name a type
  251 | s << d.count() << units-suffix;
      | ^
p1372.cpp:252:1: error: expected unqualified-id before 'return'
  252 | return os << s.str();
      | ^~~~~~
p1372.cpp:277:91: error: spurious '>>', use '>' to terminate a template argument list
  277 | template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
      |                                                                                           ^~
p1372.cpp:277:76: error: two or more data types in declaration of 'type name'
  277 | template<class charT, class traits, class Rep, class Period, class Alloc = allocator<charT>>
      |                                                                            ^~~~~~~~~~~~~~~~~
p1372.cpp:279:5: error: expected '>' before 'from_stream'
  279 |     from_stream(basic_istream<charT, traits>& is, const charT* fmt,
      |     ^~~~~~~~~~~
p1372.cpp:282:43: error: expected unqualified-id before ';' token
  282 |                 minutes* offset = nullptr);
      |                                           ^

$ g++ p1372.cpp -std=2b -o p1372g -I. -Wall
p1372.cpp:186:54: error: extended character — is not valid in an identifier
  186 | type<typename ToDuration::rep, Rep, intmax_t>::type. — If CF::num == 1 and CF::den == 1, returns
      |                                                      ^
p1372.cpp:17:45: error: 'ratio' does not name a type
   17 |          template<class Rep, class Period = ratio<1>>
      |                                             ^~~~~
p1372.cpp:17:50: error: expected '>' before '<' token
   17 |          template<class Rep, class Period = ratio<1>>
      |                                                  ^
p1372.cpp:18:25: error: expected unqualified-id before '{' token
   18 |          class duration {
      |                         ^
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
   62 | duration<long, ratio<60>> d0; // holds a count of minutes using a long
      |                ^~~~~
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:16: error: 'ratio' was not declared in this scope
p1372.cpp:62:1: error: 'duration' does not name a type
   62 | duration<long, ratio<60>> d0; // holds a count of minutes using a long
      | ^~~~~~~~
p1372.cpp:63:21: error: 'milli' was not declared in this scope
   63 | duration<long long, milli> d1; // holds a count of milliseconds using a long long
      |                     ^~~~~
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:21: error: 'milli' was not declared in this scope
p1372.cpp:63:1: error: 'duration' does not name a type
   63 | duration<long long, milli> d1; // holds a count of milliseconds using a long long
      | ^~~~~~~~
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
   64 | duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
      |                  ^~~~~
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:18: error: 'ratio' was not declared in this scope
p1372.cpp:64:1: error: 'duration' does not name a type
   64 | duration<double, ratio<1, 30>> d2; // holds a count with a tick period of 1 of a second
      | ^~~~~~~~
p1372.cpp:67:22: error: ISO C++ forbids declaration of 'duration' with no type [-fpermissive]
   67 |   constexpr explicit duration(const Rep2& r);
      |                      ^~~~~~~~
p1372.cpp:67:13: error: 'explicit' outside class declaration
   67 |   constexpr explicit duration(const Rep2& r);
      |             ^~~~~~~~
p1372.cpp:69:15: error: 'milli' was not declared in this scope
   69 | duration<int, milli> d(3);
      |               ^~~~~
p1372.cpp:69:1: error: 'duration<int, <expression error> >' does not name a type
   69 | duration<int, milli> d(3);
      | ^~~~~~~~~~~~~~~~~~~~
p1372.cpp:70:17: error: 'milli' was not declared in this scope
   70 |   duration<int, milli> d(3.5);
      |                 ^~~~~
p1372.cpp:70:3: error: 'duration<int, <expression error> >' does not name a type
   70 |   duration<int, milli> d(3.5);
      |   ^~~~~~~~~~~~~~~~~~~~
p1372.cpp:74:28: error: 'duration<Rep2, Period2>' does not name a type
   74 |   constexpr duration(const duration<Rep2, Period2>& d);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:74:13: error: ISO C++ forbids declaration of 'duration' with no type [-fpermissive]
   74 |   constexpr duration(const duration<Rep2, Period2>& d);
      |             ^~~~~~~~
p1372.cpp:79:17: error: 'milli' was not declared in this scope
   79 |   duration<int, milli> ms(3);
      |                 ^~~~~
p1372.cpp:79:3: error: 'duration<int, <expression error> >' does not name a type
   79 |   duration<int, milli> ms(3);
      |   ^~~~~~~~~~~~~~~~~~~~
p1372.cpp:80:17: error: 'micro' was not declared in this scope
   80 |   duration<int, micro> us = ms;
      |                 ^~~~~
p1372.cpp:80:3: error: 'duration<int, <expression error> >' does not name a type
   80 |   duration<int, micro> us = ms;
      |   ^~~~~~~~~~~~~~~~~~~~
p1372.cpp:81:17: error: 'milli' was not declared in this scope
   81 |   duration<int, milli> ms2 = us;
      |                 ^~~~~
p1372.cpp:81:3: error: 'duration<int, <expression error> >' does not name a type
   81 |   duration<int, milli> ms2 = us;
      |   ^~~~~~~~~~~~~~~~~~~~
p1372.cpp:84:11: error: 'rep' does not name a type
   84 | constexpr rep count() const;
      |           ^~~
p1372.cpp:87:33: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
   87 | constexpr common_type_t<duration> operator+() const;
      |                                 ^
p1372.cpp:87:33: note:   expected a type, got 'duration'
p1372.cpp:87:47: error: non-member function 'constexpr int operator+()' cannot have cv-qualifier
   87 | constexpr common_type_t<duration> operator+() const;
      |                                               ^~~~~
p1372.cpp:87:35: error: 'constexpr int operator+()' must have an argument of class or enumerated type
   87 | constexpr common_type_t<duration> operator+() const;
      |                                   ^~~~~~~~
p1372.cpp:89:33: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
   89 | constexpr common_type_t<duration> operator-() const;
      |                                 ^
p1372.cpp:89:33: note:   expected a type, got 'duration'
p1372.cpp:89:47: error: non-member function 'constexpr int operator-()' cannot have cv-qualifier
   89 | constexpr common_type_t<duration> operator-() const;
      |                                               ^~~~~
p1372.cpp:89:35: error: 'constexpr int operator-()' must have an argument of class or enumerated type
   89 | constexpr common_type_t<duration> operator-() const;
      |                                   ^~~~~~~~
p1372.cpp:91:11: error: 'duration' does not name a type
   91 | constexpr duration& operator++();
      |           ^~~~~~~~
p1372.cpp:93:11: error: 'duration' does not name a type
   93 | constexpr duration operator++(int);
      |           ^~~~~~~~
p1372.cpp:95:11: error: 'duration' does not name a type
   95 | constexpr duration& operator--();
      |           ^~~~~~~~
p1372.cpp:97:11: error: 'duration' does not name a type
   97 | constexpr duration operator--(int);
      |           ^~~~~~~~
p1372.cpp:99:11: error: 'duration' does not name a type
   99 | constexpr duration& operator+=(const duration& d);
      |           ^~~~~~~~
p1372.cpp:101:11: error: 'duration' does not name a type
  101 | constexpr duration& operator-=(const duration& d);
      |           ^~~~~~~~
p1372.cpp:103:11: error: 'duration' does not name a type
  103 | constexpr duration& operator*=(const rep& rhs);
      |           ^~~~~~~~
p1372.cpp:105:11: error: 'duration' does not name a type
  105 | constexpr duration& operator/=(const rep& rhs);
      |           ^~~~~~~~
p1372.cpp:107:11: error: 'duration' does not name a type
  107 | constexpr duration& operator%=(const rep& rhs);
      |           ^~~~~~~~
p1372.cpp:109:11: error: 'duration' does not name a type
  109 | constexpr duration& operator%=(const duration& rhs);
      |           ^~~~~~~~
p1372.cpp:112:18: error: 'duration' does not name a type
  112 | static constexpr duration zero() noexcept;
      |                  ^~~~~~~~
p1372.cpp:114:26: error: 'Rep1' was not declared in this scope
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                          ^~~~
p1372.cpp:114:32: error: 'Period1' was not declared in this scope
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                ^~~~~~~
p1372.cpp:114:17: error: 'duration<<expression error>, <expression error> >' does not name a type
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:114:62: error: 'Rep2' was not declared in this scope
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                              ^~~~
p1372.cpp:114:68: error: 'Period2' was not declared in this scope
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                                    ^~~~~~~
p1372.cpp:114:53: error: 'duration<<expression error>, <expression error> >' does not name a type
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:114:82: error: expected constructor, destructor, or type conversion before ';' token
  114 | operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                                                  ^
p1372.cpp:116:18: error: 'duration' does not name a type
  116 | static constexpr duration min() noexcept;
      |                  ^~~~~~~~
p1372.cpp:122:77: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
  122 |      constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
      |                                                                             ^~
p1372.cpp:122:77: note:   expected a type, got 'duration<Rep1, Period1>'
p1372.cpp:122:77: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
p1372.cpp:122:77: note:   expected a type, got 'duration<Rep2, Period2>'
p1372.cpp:123:1: error: expected unqualified-id before 'template'
  123 | template<class Rep1, class Period1, class Rep2, class Period2>
      | ^~~~~~~~
p1372.cpp:128:13: error: 'duration<std::common_type_t<Rep1, Rep2>, Period>' does not name a type
  128 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:132:13: error: 'duration<std::common_type_t<_Tp1, _Tp2>, Period>' does not name a type
  132 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:136:13: error: 'duration<std::common_type_t<Rep1, Rep2>, Period>' does not name a type
  136 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:142:17: error: 'duration<Rep1, Period1>' does not name a type
  142 | operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:142:53: error: 'duration<Rep2, Period2>' does not name a type
  142 | operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:142:1: error: 'constexpr std::common_type_t<Rep1, Rep2> operator/(const int&, const int&)' must have an argument of class or enumerated type
  142 | operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      | ^~~~~~~~
p1372.cpp:145:13: error: 'duration<std::common_type_t<Rep1, Rep2>, Period>' does not name a type
  145 |   constexpr duration<common_type_t<Rep1, Rep2>, Period>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:150:74: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
  150 |   constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
      |                                                                          ^~
p1372.cpp:150:74: note:   expected a type, got 'duration<Rep1, Period1>'
p1372.cpp:150:74: error: type/value mismatch at argument 1 in template parameter list for 'template<class ... _Tp> using common_type_t = typename std::common_type::type'
p1372.cpp:150:74: note:   expected a type, got 'duration<Rep2, Period2>'
p1372.cpp:151:17: error: 'duration<Rep1, Period1>' does not name a type
  151 | operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:151:53: error: 'duration<Rep2, Period2>' does not name a type
  151 | operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:151:1: error: 'constexpr int operator%(const int&, const int&)' must have an argument of class or enumerated type
  151 | operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
      | ^~~~~~~~
p1372.cpp:153:39: error: 'Rep2' was not declared in this scope
  153 |                        const duration<Rep2, Period2>& rhs);
      |                                       ^~~~
p1372.cpp:153:45: error: 'Period2' was not declared in this scope
  153 |                        const duration<Rep2, Period2>& rhs);
      |                                             ^~~~~~~
p1372.cpp:153:30: error: 'duration<<expression error>, <expression error> >' does not name a type
  153 |                        const duration<Rep2, Period2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:158:35: error: 'duration<Rep1, Period1>' does not name a type
  158 |   constexpr bool operator==(const duration<Rep1, Period1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:159:1: error: expected identifier before 'template'
  159 | template<class Rep1, class Period1, class Rep2, class Period2>
      | ^~~~~~~~
p1372.cpp:159:1: error: expected ',' or '...' before 'template'
p1372.cpp:161:58: error: expected ')' before ';' token
  161 |                       const duration<Rep2, Period2>& rhs);
      |                                                          ^
      |                                                          )
p1372.cpp:158:28: note: to match this '('
  158 |   constexpr bool operator==(const duration<Rep1, Period1>& lhs,
      |                            ^
p1372.cpp:158:18: error: 'constexpr bool operator==(const int&, int)' must have an argument of class or enumerated type
  158 |   constexpr bool operator==(const duration<Rep1, Period1>& lhs,
      |                  ^~~~~~~~
p1372.cpp:164:34: error: 'duration<Rep1, Period1>' does not name a type
  164 |   constexpr bool operator>(const duration<Rep1, Period1>& lhs,
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:166:7: error: 'duration<Rep2, Period2>' does not name a type
  166 | const duration<Rep2, Period2>& rhs);
      |       ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:164:18: error: 'constexpr bool operator>(const int&, const int&)' must have an argument of class or enumerated type
  164 |   constexpr bool operator>(const duration<Rep1, Period1>& lhs,
      |                  ^~~~~~~~
p1372.cpp:168:35: error: 'duration<Rep1, Period1>' does not name a type
  168 |   constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:169:30: error: 'duration<Rep2, Period2>' does not name a type
  169 |                        const duration<Rep2, Period2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:168:18: error: 'constexpr bool operator<=(const int&, const int&)' must have an argument of class or enumerated type
  168 |   constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
      |                  ^~~~~~~~
p1372.cpp:172:35: error: 'duration<Rep1, Period1>' does not name a type
  172 |   constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:173:30: error: 'duration<Rep2, Period2>' does not name a type
  173 |                        const duration<Rep2, Period2>& rhs);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:172:18: error: 'constexpr bool operator>=(const int&, const int&)' must have an argument of class or enumerated type
  172 |   constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
      |                  ^~~~~~~~
p1372.cpp:176:12: error: parse error in template argument list
  176 |   requires three_way_comparable<typename CT::rep>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:176:12: error: template argument 1 is invalid
p1372.cpp:177:36: error: 'duration<Rep1, Period1>' does not name a type
  177 |   constexpr auto operator<=>(const duration<Rep1, Period1>& lhs,
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:178:36: error: 'duration<Rep2, Period2>' does not name a type
  178 |                              const duration<Rep2, Period2>& rhs);
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~
p1372.cpp:177:18: error: 'constexpr auto operator<=>(const int&, const int&)' must have an argument of class or enumerated type
  177 |   constexpr auto operator<=>(const duration<Rep1, Period1>& lhs,
      |                  ^~~~~~~~
p1372.cpp:182:44: error: 'duration<Rep, Period>' does not name a type
  182 |   constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
      |                                            ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:186:1: error: 'type' does not name a type
  186 | type<typename ToDuration::rep, Rep, intmax_t>::type. — If CF::num == 1 and CF::den == 1, returns
      | ^~~~
p1372.cpp:206:27: error: 'chrono_literals' is not a namespace-name
  206 |      using namespace std::chrono_literals;
      |                           ^~~~~~~~~~~~~~~
p1372.cpp:207:26: error: unable to find numeric literal operator 'operator""h'
  207 |      auto constexpr aday=24h;
      |                          ^~~
p1372.cpp:207:26: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1372.cpp:208:28: error: unable to find numeric literal operator 'operator""min'
  208 |      auto constexpr lesson=45min;
      |                            ^~~~~
p1372.cpp:208:28: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1372.cpp:209:32: error: unable to find numeric literal operator 'operator""h'
  209 |      auto constexpr halfanhour=0.5h;
      |                                ^~~~
p1372.cpp:209:32: note: use '-fext-numeric-literals' to enable more built-in suffixes
p1372.cpp:211:19: error: 'minutes' in namespace 'std::chrono' does not name a type
  211 | constexpr chrono::minutes operator""min(unsigned long long minutes);
      |                   ^~~~~~~
p1372.cpp:212:19: error: 'duration' in namespace 'std::chrono' does not name a template type
  212 | constexpr chrono::duration<unspecified, ratio<60, 1>> operator""min(long double minutes);
      |                   ^~~~~~~~
p1372.cpp:214:19: error: 'seconds' in namespace 'std::chrono' does not name a type
  214 | constexpr chrono::seconds operator""s(unsigned long long sec); constexpr chrono::duration<unspecified> operator""s(long double sec);
      |                   ^~~~~~~
p1372.cpp:214:82: error: 'duration' in namespace 'std::chrono' does not name a template type
  214 | constexpr chrono::seconds operator""s(unsigned long long sec); constexpr chrono::duration<unspecified> operator""s(long double sec);
      |                                                                                  ^~~~~~~~
p1372.cpp:218:35: error: 'duration<Rep, Period>' does not name a type
  218 |   constexpr ToDuration ceil(const duration<Rep, Period>& d);
      |                                   ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:222:36: error: 'duration<Rep, Period>' does not name a type
  222 |   constexpr ToDuration round(const duration<Rep, Period>& d);
      |                                    ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:226:20: error: 'hours' in namespace 'std::chrono' does not name a type
  226 |  constexpr chrono::hours
      |                    ^~~~~
p1372.cpp:228:19: error: 'duration' in namespace 'std::chrono' does not name a template type
  228 | constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
      |                   ^~~~~~~~
p1372.cpp:230:19: error: 'milliseconds' in namespace 'std::chrono' does not name a type
  230 | constexpr chrono::milliseconds operator""ms(unsigned long long msec);
      |                   ^~~~~~~~~~~~
p1372.cpp:231:19: error: 'duration' in namespace 'std::chrono' does not name a template type
  231 | constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
      |                   ^~~~~~~~
p1372.cpp:233:19: error: 'microseconds' in namespace 'std::chrono' does not name a type
  233 | constexpr chrono::microseconds operator""us(unsigned long long usec); constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
      |                   ^~~~~~~~~~~~
p1372.cpp:233:89: error: 'duration' in namespace 'std::chrono' does not name a template type
  233 | constexpr chrono::microseconds operator""us(unsigned long long usec); constexpr chrono::duration<unspecified, micro> operator""us(long double usec);
      |                                                                                         ^~~~~~~~
p1372.cpp:235:19: error: 'nanoseconds' in namespace 'std::chrono' does not name a type
  235 | constexpr chrono::nanoseconds operator""ns(unsigned long long nsec);
      |                   ^~~~~~~~~~~
p1372.cpp:236:19: error: 'duration' in namespace 'std::chrono' does not name a template type
  236 | constexpr chrono::duration<unspecified, nano> operator""ns(long double nsec);
      |                   ^~~~~~~~
p1372.cpp:240:13: error: 'duration<Rep, Period>' does not name a type
  240 |   constexpr duration<Rep, Period> abs(duration<Rep, Period> d);
      |             ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:245:52: error: 'duration<Rep, Period>' does not name a type
  245 | operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);
      |                                                    ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:247:24: error: 'charT' was not declared in this scope; did you mean 'char'?
  247 |    basic_ostringstream<charT, traits> s;
      |                        ^~~~~
      |                        char
p1372.cpp:247:31: error: 'traits' was not declared in this scope
  247 |    basic_ostringstream<charT, traits> s;
      |                               ^~~~~~
p1372.cpp:247:37: error: template argument 1 is invalid
  247 |    basic_ostringstream<charT, traits> s;
      |                                     ^
p1372.cpp:247:37: error: template argument 2 is invalid
p1372.cpp:247:37: error: template argument 3 is invalid
p1372.cpp:248:4: error: 's' does not name a type
  248 |    s.flags(os.flags());
      |    ^
p1372.cpp:249:4: error: 's' does not name a type
  249 |    s.imbue(os.getloc());
      |    ^
p1372.cpp:250:4: error: 's' does not name a type
  250 |    s.precision(os.precision());
      |    ^
p1372.cpp:251:1: error: 's' does not name a type
  251 | s << d.count() << units-suffix;
      | ^
p1372.cpp:252:1: error: expected unqualified-id before 'return'
  252 | return os << s.str();
      | ^~~~~~
p1372.cpp:280:17: error: expected identifier
  280 |                 duration<Rep, Period>& d,
      |                 ^~~~~~~~~~~~~~~~~~~~~
p1372.cpp:280:38: error: expected unqualified-id before '&' token
  280 |                 duration<Rep, Period>& d,
      |                                      ^
p1372.cpp:280:38: error: expected ')' before '&' token
  280 |                 duration<Rep, Period>& d,
      |                                      ^
      |                                      )
p1372.cpp:279:16: note: to match this '('
  279 |     from_stream(basic_istream<charT, traits>& is, const charT* fmt,
      |                ^
p1372.cpp:280:40: error: expected initializer before 'd'
  280 |                 duration<Rep, Period>& d,
      |                                        ^
p1372.cpp:209:21: warning: 'halfanhour' defined but not used [-Wunused-variable]
  209 |      auto constexpr halfanhour=0.5h;
      |                     ^~~~~~~~~~
p1372.cpp:208:21: warning: 'lesson' defined but not used [-Wunused-variable]
  208 |      auto constexpr lesson=45min;
      |                     ^~~~~~
p1372.cpp:207:21: warning: 'aday' defined but not used [-Wunused-variable]
  207 |      auto constexpr aday=24h;
      |                     ^~~~

検討事項(agenda)

コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

応用例1 AUTOSAR C++

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

Autosar Guidelines C++14 example code compile list

応用例2 MISRA C++

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

MISRA C++ 5-0-16

応用例3 CERT C++

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

応用例4 箱庭 

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

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

仮想戦略会議「箱庭」

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

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

参考資料(reference)

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

自己参考資料(self reference)

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

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

#include "N4910.h"

C++N4910資料の改善点

dockerにclang

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

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

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

astyle 使ってみた

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

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

文書履歴(document history)

ver. 0.01 初稿  20220820

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0