LoginSignup
0
0

More than 1 year has passed since last update.

33.7 Condition variables [thread.condition] C++N4910:2022 (713) p1726.cpp

Last updated at Posted at 2022-10-08

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

C++ n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 のWG21を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。

ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。 

進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。

一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、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

bash
$ docker run -v /Users/ogawakiyoshi/n4910:/Users/ogawakiyoshi/n4910 -it kaizenjapan/n4910 /bin/bash

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

読書感想文

CコンパイラによるC言語規格の読書感想文として掲載しています。

コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。

読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。

個人開発

Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。

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

編纂器(Compiler)

20221008 apt update, apt -y upgrade をした。変更はなかった。

clang++ --version

20220826 以前

Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

20220827 以降

Debian clang version 14.0.6-++20220622053050+f28c006a5895-1~exp1~20220622173135.152
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.

33.7 Condition variables [thread.condition] C++N4910:2022 (713) p1726.cpp

算譜(source code)

p1726.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 = "33.7 Condition variables [thread.condition] C++N4910:2022 (713) p1726.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;

// 33.7.1 General [thread.condition.general]
//  Condition variables provide synchronization primitives used to block a thread until notified by some other thread that some condition is met or until a system time is reached. Class condition_variable provides a condition variable that can only wait on an object of type unique_lock<mutex>, allowing the implementation to be more efficient. Class condition_variable_any provides a general condition variable that can wait on objects of user-supplied lock types.
// Preconditions: lk is locked by the calling thread and either
// — no other thread is waiting on cond, or
// — lk.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects: Transfers ownership of the lock associated with lk into internal storage and schedules cond to be notified when the current thread exits, after all objects of thread storage duration associated with the current thread have been destroyed. This notification is equivalent to:
lk.unlock();
cond.notify_all();
// Synchronization: The implied lk.unlock() call is sequenced after the destruction of all objects with thread storage duration associated with the current thread.
// [Note 1: The supplied lock is held until the thread exits, which might cause deadlock due to lock ordering issues.
// [Note 2: It is the user’s responsibility to ensure that waiting threads do not erroneously assume that the thread has finished if they experience spurious wakeups. This typically requires that the condition being waited for is satisfied while holding the lock on lk, and that this lock is not released and reacquired prior to calling notify_all_at_thread_exit.
//  Condition variables permit concurrent invocation of the wait, wait_for, wait_until, notify_one and notify_all member functions.
//  The executions of notify_one and notify_all are atomic. The executions of wait, wait_for, and wait_- until are performed in three atomic parts:
// 1. the release of the mutex and entry into the waiting state; 2. the unblocking of the wait; and 3. the reacquisition of the lock.
//  The implementation behaves as if all executions of notify_one, notify_all, and each part of the wait, wait_for, and wait_until executions are executed in a single unspecified total order consistent with the“happens before” order.
//  Condition variable construction and destruction need not be synchronized.
// 33.7.2 Header <condition_variable> synopsis
namespace std {
// 33.7.4, class condition_variable class condition_variable;
// 33.7.5, class condition_variable_any class condition_variable_any;
// [condition.variable.syn]
// 33.7.3, non-member functions
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
enum class cv_status { no_timeout, timeout };
}
// 33.7.3 Non-member functions [thread.condition.nonmember]
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
// 33.7.4 Class condition_variable [thread.condition.condvar]
namespace std {
class condition_variable {
public:
    condition_variable();
    ~condition_variable();
    condition_variable(const condition_variable&) = delete;
    condition_variable& operator=(const condition_variable&) = delete;
// Throws: system_error when an exception is required (33.2.2). Error conditions:
};
}
void notify_one() noexcept;
void notify_all() noexcept;
void wait(unique_lock<mutex>& lock);
template<class Predicate>
void wait(unique_lock<mutex>& lock, Predicate pred);
template<class Clock, class Duration>
cv_status wait_until(unique_lock<mutex>& lock,
                     const chrono::time_point<Clock, Duration>& abs_time);
template<class Clock, class Duration, class Predicate>
bool wait_until(unique_lock<mutex>& lock,
                const chrono::time_point<Clock, Duration>& abs_time,
                Predicate pred);
template<class Rep, class Period>
cv_status wait_for(unique_lock<mutex>& lock,
                   const chrono::duration<Rep, Period>& rel_time);
template<class Rep, class Period, class Predicate>
bool wait_for(unique_lock<mutex>& lock,
              const chrono::duration<Rep, Period>& rel_time,
              Predicate pred);
using native_handle_type = implementation-defined;
native_handle_type native_handle();
//  The class condition_variable is a standard-layout class (11.2).
condition_variable();
// see 33.2.3 // see 33.2.3
// — resource_unavailable_try_again — if some non-memory resource limitation prevents initial- ization.
~condition_variable();
// Preconditions: There is no thread blocked on *this.
// [Note 1: That is, all threads have been notified; they can subsequently block on the lock specified in the wait. This relaxes the usual rules, which would have required all wait calls to happen before destruction. Only the notification to unblock the wait needs to happen before destruction. Undefined behavior ensues if a thread waits on *this once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads of wait, wait_for, or wait_until that take a predicate.
void notify_one() noexcept;
// Effects: If any threads are blocked waiting for *this, unblocks one of those threads. void notify_all() noexcept;
// Effects: Unblocks all threads that are blocked waiting for *this.
void wait(unique_lock<mutex>& lock);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects:— Atomically calls lock.unlock() and blocks on *this.
// — When unblocked, calls lock.lock() (possibly blocking on the lock), then returns.
// — The function will unblock when signaled by a call to notify_one() or a call to notify_all(), or spuriously.
// Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread. Throws: Nothing.
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 2: This can happen if the re-locking of the mutex throws an exception.
template<class Predicate>
void wait(unique_lock<mutex>& lock, Predicate pred);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects: Equivalent to: while (!pred())
wait(lock);
// Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread. Throws: Any exception thrown by pred.
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 3: This can happen if the re-locking of the mutex throws an exception. —end note]
template<class Clock, class Duration>
cv_status wait_until(unique_lock<mutex>& lock,
                     const chrono::time_point<Clock, Duration>& abs_time);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects:— Atomically calls lock.unlock() and blocks on *this.
// — When unblocked, calls lock.lock() (possibly blocking on the lock), then returns.
// — The function will unblock when signaled by a call to notify_one(), a call to notify_all(), expiration of the absolute timeout (33.2.4) specified by abs_time, or spuriously.
// — If the function exits via an exception, lock.lock() is called prior to exiting the function. Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.
// Returns: cv_status::timeout if the absolute timeout (33.2.4) specified by abs_time expired, otherwise cv_status::no_timeout.
// Throws: Timeout-related exceptions (33.2.4).
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 4: This can happen if the re-locking of the mutex throws an exception. —end note]
template<class Rep, class Period>
cv_status wait_for(unique_lock<mutex>& lock,
                   const chrono::duration<Rep, Period>& rel_time);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects: Equivalent to:
return wait_until(lock, chrono::steady_clock::now() + rel_time);
// Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.
// Returns: cv_status::timeout if the relative timeout (33.2.4) specified by rel_time expired, otherwise cv_status::no_timeout.
// Throws: Timeout-related exceptions (33.2.4).
// Remarks: If the function fails to meet the postcondition, terminate is invoked (14.6.2).
// [Note 5: This can happen if the re-locking of the mutex throws an exception.
//  In this subclause 33.7.5, template arguments for template parameters named Lock shall meet the Cpp17Basic- Lockable requirements (33.2.5.2).
// [Note 1: All of the standard mutex types meet this requirement. If a type other than one of the standard mutex types or a unique_lock wrapper for a standard mutex type is used with condition_variable_any, any necessary synchronization is assumed to be in place with respect to the predicate associated with the condition_variable_any instance.
template<class Clock, class Duration, class Predicate>
bool wait_until(unique_lock<mutex>& lock,
                const chrono::time_point<Clock, Duration>& abs_time,
                Predicate pred);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects: Equivalent to:
while (!pred())
    if (wait_until(lock, abs_time) == cv_status::timeout)
        return pred();
return true;
// Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.
// [Note 6 : The returned value indicates whether the predicate evaluated to true regardless of whether the timeout was triggered.
// Throws: Timeout-related exceptions (33.2.4) or any exception thrown by pred.
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 7: This can happen if the re-locking of the mutex throws an exception. —end note]
template<class Rep, class Period, class Predicate>
bool wait_for(unique_lock<mutex>& lock,
              const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
// Preconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either
// — no other thread is waiting on this condition_variable object or
// — lock.mutex() returns the same value for each of the lock arguments supplied by all concurrently waiting (via wait, wait_for, or wait_until) threads.
// Effects: Equivalent to:
return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
// [Note 8: There is no blocking if pred() is initially true, even if the timeout has already expired. —end note] Postconditions: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.
// [Note 9 : The returned value indicates whether the predicate evaluates to true regardless of whether the timeout was triggered.
// Throws: Timeout-related exceptions (33.2.4) or any exception thrown by pred.
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 10: This can happen if the re-locking of the mutex throws an exception. —end note]
// 33.7.5 Class condition_variable_any [thread.condition.condvarany]
// 33.7.5.1 General [thread.condition.condvarany.general]
namespace std {
class condition_variable_any {
public:
    condition_variable_any();
    ~condition_variable_any();
    condition_variable_any(const condition_variable_any&) = delete;
    condition_variable_any& operator=(const condition_variable_any&) = delete;
    void notify_one() noexcept;
    void notify_all() noexcept;
// 33.7.5.2, noninterruptible waits template<class Lock>
    void wait(Lock& lock);
    template<class Lock, class Predicate>
    void wait(Lock& lock, Predicate pred);
    template<class Lock, class Clock, class Duration>
    cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
    template<class Lock, class Clock, class Duration, class Predicate>
    bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
                    Predicate pred);
    template<class Lock, class Rep, class Period>
    cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
    template<class Lock, class Rep, class Period, class Predicate>
    bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
// 33.7.5.3, interruptible waits template<class Lock, class Predicate>
    bool wait(Lock& lock, stop_token stoken, Predicate pred);
    template<class Lock, class Clock, class Duration, class Predicate>
    bool wait_until(Lock& lock, stop_token stoken,
                    const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
    template<class Lock, class Rep, class Period, class Predicate>
    bool wait_for(Lock& lock, stop_token stoken,
                  const chrono::duration<Rep, Period>& rel_time, Predicate pred);
};
}
condition_variable_any();
// Throws: bad_alloc or system_error when an exception is required (33.2.2). Error conditions:
// — resource_unavailable_try_again — if some non-memory resource limitation prevents initial- ization.
// — operation_not_permitted — if the thread does not have the privilege to perform the operation.
~condition_variable_any();
// Preconditions: There is no thread blocked on *this.
// [Note 2: That is, all threads have been notified; they can subsequently block on the lock specified in the wait. This relaxes the usual rules, which would have required all wait calls to happen before destruction. Only the notification to unblock the wait needs to happen before destruction. Undefined behavior ensues if a thread waits on *this once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads of wait, wait_for, or wait_until that take a predicate.
void notify_one() noexcept;
// Effects: If any threads are blocked waiting for *this, unblocks one of those threads. void notify_all() noexcept;
// Effects: Unblocks all threads that are blocked waiting for *this.
// — When unblocked, calls lock.lock() (possibly blocking on the lock) and returns.
// — The function will unblock when signaled by a call to notify_one(), a call to notify_all(), or spuriously.
// Postconditions: lock is locked by the calling thread.
// Throws: Nothing.
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 1: This can happen if the re-locking of the mutex throws an exception.
// 33.7.5.2 Noninterruptible waits [thread.condvarany.wait]
template<class Lock>
void wait(Lock& lock);
// Effects:— Atomically calls lock.unlock() and blocks on *this.
template<class Lock, class Predicate>
void wait(Lock& lock, Predicate pred);
// Effects: Equivalent to: while (!pred())
wait(lock);
template<class Lock, class Clock, class Duration>
cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
// Effects:— Atomically calls lock.unlock() and blocks on *this.
// — When unblocked, calls lock.lock() (possibly blocking on the lock) and returns.
// — The function will unblock when signaled by a call to notify_one(), a call to notify_all(), expiration of the absolute timeout (33.2.4) specified by abs_time, or spuriously.
// — If the function exits via an exception, lock.lock() is called prior to exiting the function. Postconditions: lock is locked by the calling thread.
// Returns: cv_status::timeout if the absolute timeout (33.2.4) specified by abs_time expired, otherwise cv_status::no_timeout.
// Throws: Timeout-related exceptions (33.2.4).
// Remarks: If the function fails to meet the postcondition, terminate() is invoked (14.6.2). [Note 2: This can happen if the re-locking of the mutex throws an exception. —end note]
template<class Lock, class Rep, class Period>
cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
// Effects: Equivalent to:
return wait_until(lock, chrono::steady_clock::now() + rel_time);
// Postconditions: lock is locked by the calling thread.
// Returns: cv_status::timeout if the relative timeout (33.2.4) specified by rel_time expired, otherwise cv_status::no_timeout.
// Throws: Timeout-related exceptions (33.2.4).
// Remarks: If the function fails to meet the postcondition, terminate is invoked (14.6.2). [Note 3: This can happen if the re-locking of the mutex throws an exception. —end note]
template<class Lock, class Clock, class Duration, class Predicate>
bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
// Effects: Equivalent to:
// Effects: Registers for the duration of this call *this to get notified on a stop request on stoken during this call and then equivalent to:
while (!stoken.stop_requested()) {
    if (pred())
        return true;
    wait(lock);
}
return pred();
// [Note 1: The returned value indicates whether the predicate evaluated to true regardless of whether there was a stop request. —end note]
// Postconditions: lock is locked by the calling thread.
// Throws: Any exception thrown by pred.
// Remarks: If the function fails to meet the postcondition, terminate is called (14.6.2). [Note 2: This can happen if the re-locking of the mutex throws an exception.
while (!pred())
    if (wait_until(lock, abs_time) == cv_status::timeout)
        return pred();
return true;
// [Note 4: There is no blocking if pred() is initially true, or if the timeout has already expired. —end note] [Note 5 : The returned value indicates whether the predicate evaluates to true regardless of whether the timeout was triggered.
//  The following wait functions will be notified when there is a stop request on the passed stop_token. In that case the functions return immediately, returning false if the predicate evaluates to false.
template<class Lock, class Predicate>
bool wait(Lock& lock, stop_token stoken, Predicate pred);
template<class Lock, class Rep, class Period, class Predicate>
bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
// Effects: Equivalent to:
return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
// 33.7.5.3 Interruptible waits [thread.condvarany.intwait]
template<class Lock, class Clock, class Duration, class Predicate>
bool wait_until(Lock& lock, stop_token stoken,
                const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
// Effects: Registers for the duration of this call *this to get notified on a stop request on stoken during this call and then equivalent to:
while (!stoken.stop_requested()) {
    if (pred())
        return true;
    if (wait_until(lock, abs_time) == cv_status::timeout)
        return pred();
}
return pred();
// [Note 3: There is no blocking if pred() is initially true, stoken.stop_requested() was already true or the timeout has already expired.
// [Note 4 : The returned value indicates whether the predicate evaluated to true regardless of whether the timeout was triggered or a stop request was made.
// Postconditions: lock is locked by the calling thread.
// Throws: Timeout-related exceptions (33.2.4), or any exception thrown by pred. Remarks: If the function fails to meet the postcondition, terminate is called (14.6.2). [Note 5: This can happen if the re-locking of the mutex throws an exception.
template<class Lock, class Rep, class Period, class Predicate>
bool wait_for(Lock& lock, stop_token stoken,
              const chrono::duration<Rep, Period>& rel_time, Predicate pred);
// Effects: Equivalent to:
return wait_until(lock, std::move(stoken), chrono::steady_clock::now() + rel_time,
                  std::move(pred));
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1726.cpp -std=03 -o p1726l -I. -Wall
In file included from p1726.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 \
 ^
p1726.cpp:20:3: error: unknown type name 'lk'
  lk.unlock();
  ^
p1726.cpp:20:5: error: cannot use dot operator on a type
  lk.unlock();
    ^
p1726.cpp:21:3: error: unknown type name 'cond'
  cond.notify_all();
  ^
p1726.cpp:21:7: error: cannot use dot operator on a type
  cond.notify_all();
      ^
p1726.cpp:36:70: error: use of undeclared identifier 'mutex'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                                                                     ^
p1726.cpp:36:32: error: unknown type name 'condition_variable'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                               ^
p1726.cpp:37:10: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
    enum class cv_status { no_timeout, timeout };
         ^
p1726.cpp:40:70: error: use of undeclared identifier 'mutex'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                                                                     ^
p1726.cpp:40:32: error: unknown type name 'condition_variable'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                               ^
p1726.cpp:46:49: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
condition_variable(const condition_variable&) = delete;
                                                ^
p1726.cpp:47:60: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
condition_variable& operator=(const condition_variable&) = delete;
                                                           ^
p1726.cpp:50:19: error: expected function body after function declarator
void notify_one() noexcept;
                  ^
p1726.cpp:51:19: error: expected function body after function declarator
void notify_all() noexcept;
                  ^
p1726.cpp:52:23: error: use of undeclared identifier 'mutex'
void wait(unique_lock<mutex>& lock);
                      ^
p1726.cpp:54:25: error: use of undeclared identifier 'mutex'
  void wait(unique_lock<mutex>& lock, Predicate pred);
                        ^
p1726.cpp:56:36: error: use of undeclared identifier 'mutex'
  cv_status wait_until(unique_lock<mutex>& lock,
                                   ^
p1726.cpp:57:30: error: use of undeclared identifier 'chrono'
                       const chrono::time_point<Clock, Duration>& abs_time);
                             ^
p1726.cpp:59:31: error: use of undeclared identifier 'mutex'
  bool wait_until(unique_lock<mutex>& lock,
                              ^
p1726.cpp:60:25: error: use of undeclared identifier 'chrono'
                  const chrono::time_point<Clock, Duration>& abs_time,
                        ^
p1726.cpp:63:34: error: use of undeclared identifier 'mutex'
  cv_status wait_for(unique_lock<mutex>& lock,
                                 ^
p1726.cpp:64:28: error: use of undeclared identifier 'chrono'
                     const chrono::duration<Rep, Period>& rel_time);
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
$ clang++ p1726.cpp -std=2b -o p1726l -I. -Wall
p1726.cpp:20:3: error: unknown type name 'lk'
  lk.unlock();
  ^
p1726.cpp:20:5: error: cannot use dot operator on a type
  lk.unlock();
    ^
p1726.cpp:21:3: error: unknown type name 'cond'
  cond.notify_all();
  ^
p1726.cpp:21:7: error: cannot use dot operator on a type
  cond.notify_all();
      ^
p1726.cpp:36:70: error: use of undeclared identifier 'mutex'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                                                                     ^
p1726.cpp:36:32: error: unknown type name 'condition_variable'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                               ^
p1726.cpp:40:70: error: use of undeclared identifier 'mutex'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                                                                     ^
p1726.cpp:40:32: error: unknown type name 'condition_variable'
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
                               ^
p1726.cpp:52:23: error: use of undeclared identifier 'mutex'
void wait(unique_lock<mutex>& lock);
                      ^
p1726.cpp:54:25: error: use of undeclared identifier 'mutex'
  void wait(unique_lock<mutex>& lock, Predicate pred);
                        ^
p1726.cpp:56:36: error: use of undeclared identifier 'mutex'
  cv_status wait_until(unique_lock<mutex>& lock,
                                   ^
p1726.cpp:57:30: error: use of undeclared identifier 'chrono'
                       const chrono::time_point<Clock, Duration>& abs_time);
                             ^
p1726.cpp:59:31: error: use of undeclared identifier 'mutex'
  bool wait_until(unique_lock<mutex>& lock,
                              ^
p1726.cpp:60:25: error: use of undeclared identifier 'chrono'
                  const chrono::time_point<Clock, Duration>& abs_time,
                        ^
p1726.cpp:63:34: error: use of undeclared identifier 'mutex'
  cv_status wait_for(unique_lock<mutex>& lock,
                                 ^
p1726.cpp:64:28: error: use of undeclared identifier 'chrono'
                     const chrono::duration<Rep, Period>& rel_time);
                           ^
p1726.cpp:66:29: error: use of undeclared identifier 'mutex'
  bool wait_for(unique_lock<mutex>& lock,
                            ^
p1726.cpp:67:23: error: use of undeclared identifier 'chrono'
                const chrono::duration<Rep, Period>& rel_time,
                      ^
p1726.cpp:69:28: error: unknown type name 'implementation'
using native_handle_type = implementation-defined; native_handle_type native_handle();
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1726.cpp -std=03 -o p1726g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1726.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 \
      |  ^~~~~
p1726.cpp:50:19: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   50 | void notify_one() noexcept;
      |                   ^~~~~~~~
p1726.cpp:20:3: error: 'lk' does not name a type
   20 |   lk.unlock();
      |   ^~
p1726.cpp:21:3: error: 'cond' does not name a type
   21 |   cond.notify_all();
      |   ^~~~
p1726.cpp:36:6: error: variable or field 'notify_all_at_thread_exit' declared void
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
p1726.cpp:36:32: error: 'condition_variable' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                ^~~~~~~~~~~~~~~~~~
p1726.cpp:36:32: note: 'std::condition_variable' is only available from C++11 onwards
p1726.cpp:36:52: error: 'cond' was not declared in this scope; did you mean 'conj'?
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                    ^~~~
      |                                                    conj
p1726.cpp:36:58: error: 'unique_lock' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                          ^~~~~~~~~~~
p1726.cpp:36:58: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:36:70: error: 'mutex' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                      ^~~~~
p1726.cpp:36:70: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:36:77: error: 'lk' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                             ^~
p1726.cpp:37:5: warning: scoped enums only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   37 |     enum class cv_status { no_timeout, timeout };
      |     ^~~~
p1726.cpp:40:6: error: variable or field 'notify_all_at_thread_exit' declared void
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
p1726.cpp:40:32: error: 'condition_variable' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                ^~~~~~~~~~~~~~~~~~
p1726.cpp:40:32: note: 'std::condition_variable' is only available from C++11 onwards
p1726.cpp:40:52: error: 'cond' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                    ^~~~
p1726.cpp:40:58: error: 'unique_lock' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                          ^~~~~~~~~~~
p1726.cpp:40:58: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:40:70: error: 'mutex' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                      ^~~~~
p1726.cpp:40:70: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:40:77: error: 'lk' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                             ^~
p1726.cpp:46:49: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   46 | condition_variable(const condition_variable&) = delete;
      |                                                 ^~~~~~
p1726.cpp:47:60: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   47 | condition_variable& operator=(const condition_variable&) = delete;
      |                                                            ^~~~~~
p1726.cpp:50:19: error: expected initializer before 'noexcept'
   50 | void notify_one() noexcept;
      |                   ^~~~~~~~
p1726.cpp:51:19: error: expected initializer before 'noexcept'
   51 | void notify_all() noexcept;
      |                   ^~~~~~~~
p1726.cpp:52:6: error: variable or field 'wait' declared void
   52 | void wait(unique_lock<mutex>& lock);
      |      ^~~~
p1726.cpp:52:11: error: 'unique_lock' was not declared in this scope
   52 | void wait(unique_lock<mutex>& lock);
      |           ^~~~~~~~~~~
p1726.cpp:52:11: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:52:23: error: 'mutex' was not declared in this scope
   52 | void wait(unique_lock<mutex>& lock);
      |                       ^~~~~
p1726.cpp:52:23: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:52:31: error: 'lock' was not declared in this scope
   52 | void wait(unique_lock<mutex>& lock);
      |                               ^~~~
p1726.cpp:52:31: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:54:8: error: variable or field 'wait' declared void
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |        ^~~~
p1726.cpp:54:13: error: 'unique_lock' was not declared in this scope
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |             ^~~~~~~~~~~
p1726.cpp:54:13: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:54:25: error: 'mutex' was not declared in this scope
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                         ^~~~~
p1726.cpp:54:25: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:54:33: error: 'lock' was not declared in this scope
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                 ^~~~
p1726.cpp:54:33: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:54:49: error: expected primary-expression before 'pred'
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                                 ^~~~
p1726.cpp:56:24: error: 'unique_lock' was not declared in this scope
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                        ^~~~~~~~~~~
p1726.cpp:56:24: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:56:36: error: 'mutex' was not declared in this scope
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                    ^~~~~
p1726.cpp:56:36: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:56:44: error: 'lock' was not declared in this scope
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                            ^~~~
p1726.cpp:56:44: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:57:24: error: expected primary-expression before 'const'
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~
p1726.cpp:57:64: error: expected primary-expression before '>' token
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                ^
p1726.cpp:57:67: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                   ^~~~~~~~
      |                                                                   asctime
p1726.cpp:57:75: error: expression list treated as compound expression in initializer [-fpermissive]
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                           ^
p1726.cpp:56:13: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:59:19: error: redeclaration of 'template<class Clock, class Duration, class Predicate> bool wait_until'
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:56:13: note: previous declaration 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>'
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:59:19: error: 'unique_lock' was not declared in this scope
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:59:19: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:59:31: error: 'mutex' was not declared in this scope
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                               ^~~~~
p1726.cpp:59:31: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:59:39: error: 'lock' was not declared in this scope
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                                       ^~~~
p1726.cpp:59:39: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:60:19: error: expected primary-expression before 'const'
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                   ^~~~~
p1726.cpp:60:59: error: expected primary-expression before '>' token
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                                                           ^
p1726.cpp:60:62: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                                                              ^~~~~~~~
      |                                                              asctime
p1726.cpp:61:29: error: expected primary-expression before 'pred'
   61 |                   Predicate pred);
      |                             ^~~~
p1726.cpp:61:33: error: expression list treated as compound expression in initializer [-fpermissive]
   61 |                   Predicate pred);
      |                                 ^
p1726.cpp:59:8: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |        ^~~~~~~~~~
p1726.cpp:63:22: error: 'unique_lock' was not declared in this scope
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                      ^~~~~~~~~~~
p1726.cpp:63:22: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:63:34: error: 'mutex' was not declared in this scope
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                  ^~~~~
p1726.cpp:63:34: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:63:42: error: 'lock' was not declared in this scope
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                          ^~~~
p1726.cpp:63:42: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:64:22: error: expected primary-expression before 'const'
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~
p1726.cpp:64:56: error: expected primary-expression before '>' token
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                        ^
p1726.cpp:64:59: error: 'rel_time' was not declared in this scope
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                           ^~~~~~~~
p1726.cpp:64:67: error: expression list treated as compound expression in initializer [-fpermissive]
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                                   ^
p1726.cpp:63:13: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:66:17: error: redeclaration of 'template<class Rep, class Period, class Predicate> bool wait_for'
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:63:13: note: previous declaration 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>'
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:66:17: error: 'unique_lock' was not declared in this scope
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:66:17: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:66:29: error: 'mutex' was not declared in this scope
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                             ^~~~~
p1726.cpp:66:29: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:66:37: error: 'lock' was not declared in this scope
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                                     ^~~~
p1726.cpp:66:37: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:67:17: error: expected primary-expression before 'const'
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                 ^~~~~
p1726.cpp:67:51: error: expected primary-expression before '>' token
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                                                   ^
p1726.cpp:67:54: error: 'rel_time' was not declared in this scope
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                                                      ^~~~~~~~
p1726.cpp:68:27: error: expected primary-expression before 'pred'
   68 |                 Predicate pred);
      |                           ^~~~
p1726.cpp:68:31: error: expression list treated as compound expression in initializer [-fpermissive]
   68 |                 Predicate pred);
      |                               ^
p1726.cpp:66:8: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |        ^~~~~~~~
p1726.cpp:69:7: error: expected nested-name-specifier before 'native_handle_type'
   69 | using native_handle_type = implementation-defined; native_handle_type native_handle();
      |       ^~~~~~~~~~~~~~~~~~
p1726.cpp:69:52: error: 'native_handle_type' does not name a type
   69 | using native_handle_type = implementation-defined; native_handle_type native_handle();
      |                                                    ^~~~~~~~~~~~~~~~~~
p1726.cpp:71:23: error: expected unqualified-id before ')' token
   71 |    condition_variable();
      |                       ^
p1726.cpp:74:22: error: expected constructor, destructor, or type conversion before ';' token
   74 | ~condition_variable();
      |                      ^
p1726.cpp:77:19: error: expected initializer before 'noexcept'
   77 | void notify_one() noexcept;
      |                   ^~~~~~~~
p1726.cpp:80:6: error: variable or field 'wait' declared void
   80 | void wait(unique_lock<mutex>& lock);
      |      ^~~~
p1726.cpp:80:11: error: 'unique_lock' was not declared in this scope
   80 | void wait(unique_lock<mutex>& lock);
      |           ^~~~~~~~~~~
p1726.cpp:80:11: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:80:23: error: 'mutex' was not declared in this scope
   80 | void wait(unique_lock<mutex>& lock);
      |                       ^~~~~
p1726.cpp:80:23: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:80:31: error: 'lock' was not declared in this scope
   80 | void wait(unique_lock<mutex>& lock);
      |                               ^~~~
p1726.cpp:80:31: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:90:8: error: variable or field 'wait' declared void
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |        ^~~~
p1726.cpp:90:13: error: 'unique_lock' was not declared in this scope
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |             ^~~~~~~~~~~
p1726.cpp:90:13: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:90:25: error: 'mutex' was not declared in this scope
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                         ^~~~~
p1726.cpp:90:25: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:90:33: error: 'lock' was not declared in this scope
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                 ^~~~
p1726.cpp:90:33: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:90:49: error: expected primary-expression before 'pred'
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                                 ^~~~
p1726.cpp:95:5: error: expected constructor, destructor, or type conversion before '(' token
   95 | wait(lock);
      |     ^
p1726.cpp:99:13: error: redefinition of 'template<class Clock, class Duration> std::cv_status wait_until'
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:56:13: note: 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>' previously declared here
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:99:24: error: 'unique_lock' was not declared in this scope
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                        ^~~~~~~~~~~
p1726.cpp:99:24: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:99:36: error: 'mutex' was not declared in this scope
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                    ^~~~~
p1726.cpp:99:36: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:99:44: error: 'lock' was not declared in this scope
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                            ^~~~
p1726.cpp:99:44: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:100:19: error: expected primary-expression before 'const'
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                   ^~~~~
p1726.cpp:100:59: error: expected primary-expression before '>' token
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                                                           ^
p1726.cpp:100:62: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                                                              ^~~~~~~~
      |                                                              asctime
p1726.cpp:112:13: error: redefinition of 'template<class Rep, class Period> std::cv_status wait_for'
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:63:13: note: 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>' previously declared here
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:112:22: error: 'unique_lock' was not declared in this scope
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                      ^~~~~~~~~~~
p1726.cpp:112:22: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:112:34: error: 'mutex' was not declared in this scope
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                  ^~~~~
p1726.cpp:112:34: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:112:42: error: 'lock' was not declared in this scope
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                          ^~~~
p1726.cpp:112:42: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:113:17: error: expected primary-expression before 'const'
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                 ^~~~~
p1726.cpp:113:51: error: expected primary-expression before '>' token
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                                                   ^
p1726.cpp:113:54: error: 'rel_time' was not declared in this scope
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                                                      ^~~~~~~~
p1726.cpp:118:1: error: expected unqualified-id before 'return'
  118 | return wait_until(lock, chrono::steady_clock::now() + rel_time);
      | ^~~~~~
p1726.cpp:127:19: error: redeclaration of 'template<class Clock, class Duration, class Predicate> bool wait_until'
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:56:13: note: previous declaration 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>'
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:127:19: error: 'unique_lock' was not declared in this scope
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:127:19: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:127:31: error: 'mutex' was not declared in this scope
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                               ^~~~~
p1726.cpp:127:31: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:127:39: error: 'lock' was not declared in this scope
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                                       ^~~~
p1726.cpp:127:39: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:128:14: error: expected primary-expression before 'const'
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |              ^~~~~
p1726.cpp:128:54: error: expected primary-expression before '>' token
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |                                                      ^
p1726.cpp:128:57: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |                                                         ^~~~~~~~
      |                                                         asctime
p1726.cpp:129:24: error: expected primary-expression before 'pred'
  129 |              Predicate pred);
      |                        ^~~~
p1726.cpp:129:28: error: expression list treated as compound expression in initializer [-fpermissive]
  129 |              Predicate pred);
      |                            ^
p1726.cpp:127:8: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |        ^~~~~~~~~~
p1726.cpp:134:3: error: expected unqualified-id before 'while'
  134 |   while (!pred())
      |   ^~~~~
p1726.cpp:137:3: error: expected unqualified-id before 'return'
  137 |   return true;
      |   ^~~~~~
p1726.cpp:143:17: error: redeclaration of 'template<class Rep, class Period, class Predicate> bool wait_for'
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:63:13: note: previous declaration 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>'
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:143:17: error: 'unique_lock' was not declared in this scope
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:143:17: note: 'std::unique_lock' is only available from C++11 onwards
p1726.cpp:143:29: error: 'mutex' was not declared in this scope
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                             ^~~~~
p1726.cpp:143:29: note: 'std::mutex' is only available from C++11 onwards
p1726.cpp:143:37: error: 'lock' was not declared in this scope
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                                     ^~~~
p1726.cpp:143:37: note: 'std::lock' is only available from C++11 onwards
p1726.cpp:144:12: error: expected primary-expression before 'const'
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |            ^~~~~
p1726.cpp:144:46: error: expected primary-expression before '>' token
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                              ^
p1726.cpp:144:49: error: 'rel_time' was not declared in this scope
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                 ^~~~~~~~
p1726.cpp:144:79: error: expected primary-expression before 'pred'
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                                               ^~~~
p1726.cpp:144:83: error: expression list treated as compound expression in initializer [-fpermissive]
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                                                   ^
p1726.cpp:143:8: warning: variable templates only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |        ^~~~~~~~
p1726.cpp:149:1: error: expected unqualified-id before 'return'
  149 | return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
      | ^~~~~~
p1726.cpp:160:63: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  160 |       condition_variable_any(const condition_variable_any&) = delete;
      |                                                               ^~~~~~
p1726.cpp:161:74: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  161 |       condition_variable_any& operator=(const condition_variable_any&) = delete;
      |                                                                          ^~~~~~
p1726.cpp:162:23: error: expected ';' at end of member declaration
  162 |       void notify_one() noexcept;
      |                       ^
      |                        ;
p1726.cpp:162:25: error: 'noexcept' does not name a type
  162 |       void notify_one() noexcept;
      |                         ^~~~~~~~
p1726.cpp:162:25: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1726.cpp:163:23: error: expected ';' at end of member declaration
  163 |       void notify_all() noexcept;
      |                       ^
      |                        ;
p1726.cpp:163:25: error: 'noexcept' does not name a type
  163 |       void notify_all() noexcept;
      |                         ^~~~~~~~
p1726.cpp:163:25: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1726.cpp:165:19: error: 'Lock' has not been declared
  165 |         void wait(Lock& lock);
      |                   ^~~~
p1726.cpp:169:48: error: 'chrono' does not name a type
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                ^~~~~~
p1726.cpp:169:66: error: expected unqualified-id before '<' token
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                  ^
p1726.cpp:169:66: error: expected ')' before '<' token
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                             ~                                    ^
      |                                                                  )
p1726.cpp:169:66: error: expected initializer before '<' token
p1726.cpp:171:43: error: 'chrono' does not name a type
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                                           ^~~~~~
p1726.cpp:171:61: error: expected unqualified-id before '<' token
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                                                             ^
p1726.cpp:171:61: error: expected ')' before '<' token
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                        ~                                    ^
      |                                                             )
p1726.cpp:171:61: error: expected initializer before '<' token
p1726.cpp:174:46: error: 'chrono' does not name a type
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                              ^~~~~~
p1726.cpp:174:62: error: expected unqualified-id before '<' token
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                                              ^
p1726.cpp:174:62: error: expected ')' before '<' token
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                           ~                                  ^
      |                                                              )
p1726.cpp:174:62: error: expected initializer before '<' token
p1726.cpp:176:41: error: 'chrono' does not name a type
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                         ^~~~~~
p1726.cpp:176:57: error: expected unqualified-id before '<' token
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                                         ^
p1726.cpp:176:57: error: expected ')' before '<' token
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                      ~                                  ^
      |                                                         )
p1726.cpp:176:57: error: expected initializer before '<' token
p1726.cpp:178:19: error: 'Lock' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                   ^~~~
p1726.cpp:178:31: error: 'stop_token' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                               ^~~~~~~~~~
p1726.cpp:178:50: error: 'Predicate' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                                                  ^~~~~~~~~
p1726.cpp:180:37: error: 'stop_token' has not been declared
  180 |         bool wait_until(Lock& lock, stop_token stoken,
      |                                     ^~~~~~~~~~
p1726.cpp:181:31: error: 'chrono' does not name a type
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                               ^~~~~~
p1726.cpp:181:49: error: expected unqualified-id before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
p1726.cpp:181:49: error: expected ')' before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
      |                                                 )
p1726.cpp:180:24: note: to match this '('
  180 |         bool wait_until(Lock& lock, stop_token stoken,
      |                        ^
p1726.cpp:181:49: error: expected initializer before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
p1726.cpp:183:35: error: 'stop_token' has not been declared
  183 |         bool wait_for(Lock& lock, stop_token stoken,
      |                                   ^~~~~~~~~~
p1726.cpp:184:29: error: 'chrono' does not name a type
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                             ^~~~~~
p1726.cpp:184:45: error: expected unqualified-id before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
p1726.cpp:184:45: error: expected ')' before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
      |                                             )
p1726.cpp:183:22: note: to match this '('
  183 |         bool wait_for(Lock& lock, stop_token stoken,
      |                      ^
p1726.cpp:184:45: error: expected initializer before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
p1726.cpp:186:24: error: expected unqualified-id before ')' token
  186 | condition_variable_any();
      |                        ^
p1726.cpp:190:26: error: expected constructor, destructor, or type conversion before ';' token
  190 | ~condition_variable_any();
      |                          ^
p1726.cpp:193:19: error: expected initializer before 'noexcept'
  193 | void notify_one() noexcept;
      |                   ^~~~~~~~
p1726.cpp:208:5: error: expected constructor, destructor, or type conversion before '(' token
  208 | wait(lock);
      |     ^
p1726.cpp:210:42: error: 'chrono' does not name a type
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^~~~~~
p1726.cpp:210:60: error: expected unqualified-id before '<' token
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                            ^
p1726.cpp:210:60: error: expected ')' before '<' token
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                       ~                                    ^
      |                                                            )
p1726.cpp:210:60: error: expected initializer before '<' token
p1726.cpp:219:40: error: 'chrono' does not name a type
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                        ^~~~~~
p1726.cpp:219:56: error: expected unqualified-id before '<' token
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                                        ^
p1726.cpp:219:56: error: expected ')' before '<' token
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                     ~                                  ^
      |                                                        )
p1726.cpp:219:56: error: expected initializer before '<' token
p1726.cpp:221:1: error: expected unqualified-id before 'return'
  221 | return wait_until(lock, chrono::steady_clock::now() + rel_time);
      | ^~~~~~
p1726.cpp:227:37: error: 'chrono' does not name a type
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                     ^~~~~~
p1726.cpp:227:55: error: expected unqualified-id before '<' token
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                       ^
p1726.cpp:227:55: error: expected ')' before '<' token
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                  ~                                    ^
      |                                                       )
p1726.cpp:227:55: error: expected initializer before '<' token
p1726.cpp:230:3: error: expected unqualified-id before 'while'
  230 |   while (!stoken.stop_requested()) {
      |   ^~~~~
p1726.cpp:235:3: error: expected unqualified-id before 'return'
  235 |   return pred();
      |   ^~~~~~
p1726.cpp:240:3: error: expected unqualified-id before 'while'
  240 |   while (!pred())
      |   ^~~~~
p1726.cpp:243:3: error: expected unqualified-id before 'return'
  243 |   return true;
      |   ^~~~~~
p1726.cpp:247:28: error: 'stop_token' has not been declared
  247 |      bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                            ^~~~~~~~~~
p1726.cpp:249:33: error: 'chrono' does not name a type
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                 ^~~~~~
p1726.cpp:249:49: error: expected unqualified-id before '<' token
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                                 ^
p1726.cpp:249:49: error: expected ')' before '<' token
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |              ~                                  ^
      |                                                 )
p1726.cpp:249:49: error: expected initializer before '<' token
p1726.cpp:251:1: error: expected unqualified-id before 'return'
  251 | return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
      | ^~~~~~
p1726.cpp:254:31: error: 'stop_token' has not been declared
  254 |   bool wait_until(Lock& lock, stop_token stoken,
      |                               ^~~~~~~~~~
p1726.cpp:255:20: error: 'chrono' does not name a type
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                    ^~~~~~
p1726.cpp:255:38: error: expected unqualified-id before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
p1726.cpp:255:38: error: expected ')' before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
      |                                      )
p1726.cpp:254:18: note: to match this '('
  254 |   bool wait_until(Lock& lock, stop_token stoken,
      |                  ^
p1726.cpp:255:38: error: expected initializer before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
p1726.cpp:257:3: error: expected unqualified-id before 'while'
  257 |   while (!stoken.stop_requested()) {
      |   ^~~~~
p1726.cpp:263:1: error: expected unqualified-id before 'return'
  263 | return pred();
      | ^~~~~~
p1726.cpp:269:29: error: 'stop_token' has not been declared
  269 |   bool wait_for(Lock& lock, stop_token stoken,
      |                             ^~~~~~~~~~
p1726.cpp:270:23: error: 'chrono' does not name a type
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                       ^~~~~~
p1726.cpp:270:39: error: expected unqualified-id before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
p1726.cpp:270:39: error: expected ')' before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
      |                                       )
p1726.cpp:269:16: note: to match this '('
  269 |   bool wait_for(Lock& lock, stop_token stoken,
      |                ^
p1726.cpp:270:39: error: expected initializer before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
p1726.cpp:272:1: error: expected unqualified-id before 'return'
  272 | return wait_until(lock, std::move(stoken), chrono::steady_clock::now() + rel_time,
      | ^~~~~~

$ g++ p1726.cpp -std=2b -o p1726g -I. -Wall
p1726.cpp:20:3: error: 'lk' does not name a type
   20 |   lk.unlock();
      |   ^~
p1726.cpp:21:3: error: 'cond' does not name a type
   21 |   cond.notify_all();
      |   ^~~~
p1726.cpp:36:6: error: variable or field 'notify_all_at_thread_exit' declared void
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
p1726.cpp:36:32: error: 'condition_variable' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                ^~~~~~~~~~~~~~~~~~
p1726.cpp:11:1: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
   10 | #include "N4910.h"
  +++ |+#include <condition_variable>
   11 | 
p1726.cpp:36:52: error: 'cond' was not declared in this scope; did you mean 'conj'?
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                    ^~~~
      |                                                    conj
p1726.cpp:36:58: error: 'unique_lock' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                          ^~~~~~~~~~~
p1726.cpp:11:1: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   10 | #include "N4910.h"
  +++ |+#include <mutex>
   11 | 
p1726.cpp:36:75: error: expected primary-expression before '>' token
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                           ^
p1726.cpp:36:77: error: 'lk' was not declared in this scope
   36 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                             ^~
p1726.cpp:40:6: error: variable or field 'notify_all_at_thread_exit' declared void
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
p1726.cpp:40:32: error: 'condition_variable' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                ^~~~~~~~~~~~~~~~~~
p1726.cpp:40:32: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
p1726.cpp:40:52: error: 'cond' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                    ^~~~
p1726.cpp:40:58: error: 'unique_lock' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                          ^~~~~~~~~~~
p1726.cpp:40:58: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:40:75: error: expected primary-expression before '>' token
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                           ^
p1726.cpp:40:77: error: 'lk' was not declared in this scope
   40 | void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
      |                                                                             ^~
p1726.cpp:52:6: error: variable or field 'wait' declared void
   52 | void wait(unique_lock<mutex>& lock);
      |      ^~~~
p1726.cpp:52:11: error: 'unique_lock' was not declared in this scope
   52 | void wait(unique_lock<mutex>& lock);
      |           ^~~~~~~~~~~
p1726.cpp:52:11: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:52:28: error: expected primary-expression before '>' token
   52 | void wait(unique_lock<mutex>& lock);
      |                            ^
p1726.cpp:52:31: error: 'lock' was not declared in this scope
   52 | void wait(unique_lock<mutex>& lock);
      |                               ^~~~
p1726.cpp:52:31: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:54:8: error: variable or field 'wait' declared void
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |        ^~~~
p1726.cpp:54:13: error: 'unique_lock' was not declared in this scope
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |             ^~~~~~~~~~~
p1726.cpp:54:13: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:54:30: error: expected primary-expression before '>' token
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                              ^
p1726.cpp:54:33: error: 'lock' was not declared in this scope
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                 ^~~~
p1726.cpp:54:33: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:54:49: error: expected primary-expression before 'pred'
   54 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                                 ^~~~
p1726.cpp:56:24: error: 'unique_lock' was not declared in this scope
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                        ^~~~~~~~~~~
p1726.cpp:56:24: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:56:41: error: expected primary-expression before '>' token
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                         ^
p1726.cpp:56:44: error: 'lock' was not declared in this scope
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                            ^~~~
p1726.cpp:56:44: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:57:24: error: expected primary-expression before 'const'
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~
p1726.cpp:57:64: error: expected primary-expression before '>' token
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                ^
p1726.cpp:57:67: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                   ^~~~~~~~
      |                                                                   asctime
p1726.cpp:57:75: error: expression list treated as compound expression in initializer [-fpermissive]
   57 |                        const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                           ^
p1726.cpp:59:19: error: redeclaration of 'template<class Clock, class Duration, class Predicate> bool wait_until'
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:56:13: note: previous declaration 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>'
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:59:19: error: 'unique_lock' was not declared in this scope
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:59:19: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:59:36: error: expected primary-expression before '>' token
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                                    ^
p1726.cpp:59:39: error: 'lock' was not declared in this scope
   59 |   bool wait_until(unique_lock<mutex>& lock,
      |                                       ^~~~
p1726.cpp:59:39: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:60:19: error: expected primary-expression before 'const'
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                   ^~~~~
p1726.cpp:60:59: error: expected primary-expression before '>' token
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                                                           ^
p1726.cpp:60:62: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
   60 |                   const chrono::time_point<Clock, Duration>& abs_time,
      |                                                              ^~~~~~~~
      |                                                              asctime
p1726.cpp:61:29: error: expected primary-expression before 'pred'
   61 |                   Predicate pred);
      |                             ^~~~
p1726.cpp:61:33: error: expression list treated as compound expression in initializer [-fpermissive]
   61 |                   Predicate pred);
      |                                 ^
p1726.cpp:63:22: error: 'unique_lock' was not declared in this scope
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                      ^~~~~~~~~~~
p1726.cpp:63:22: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:63:39: error: expected primary-expression before '>' token
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                       ^
p1726.cpp:63:42: error: 'lock' was not declared in this scope
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                          ^~~~
p1726.cpp:63:42: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:64:22: error: expected primary-expression before 'const'
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~
p1726.cpp:64:56: error: expected primary-expression before '>' token
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                        ^
p1726.cpp:64:59: error: 'rel_time' was not declared in this scope
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                           ^~~~~~~~
p1726.cpp:64:67: error: expression list treated as compound expression in initializer [-fpermissive]
   64 |                      const chrono::duration<Rep, Period>& rel_time);
      |                                                                   ^
p1726.cpp:66:17: error: redeclaration of 'template<class Rep, class Period, class Predicate> bool wait_for'
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:63:13: note: previous declaration 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>'
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:66:17: error: 'unique_lock' was not declared in this scope
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:66:17: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:66:34: error: expected primary-expression before '>' token
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                                  ^
p1726.cpp:66:37: error: 'lock' was not declared in this scope
   66 |   bool wait_for(unique_lock<mutex>& lock,
      |                                     ^~~~
p1726.cpp:66:37: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:67:17: error: expected primary-expression before 'const'
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                 ^~~~~
p1726.cpp:67:51: error: expected primary-expression before '>' token
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                                                   ^
p1726.cpp:67:54: error: 'rel_time' was not declared in this scope
   67 |                 const chrono::duration<Rep, Period>& rel_time,
      |                                                      ^~~~~~~~
p1726.cpp:68:27: error: expected primary-expression before 'pred'
   68 |                 Predicate pred);
      |                           ^~~~
p1726.cpp:68:31: error: expression list treated as compound expression in initializer [-fpermissive]
   68 |                 Predicate pred);
      |                               ^
p1726.cpp:69:28: error: 'implementation' does not name a type
   69 | using native_handle_type = implementation-defined; native_handle_type native_handle();
      |                            ^~~~~~~~~~~~~~
p1726.cpp:69:52: error: 'native_handle_type' does not name a type
   69 | using native_handle_type = implementation-defined; native_handle_type native_handle();
      |                                                    ^~~~~~~~~~~~~~~~~~
p1726.cpp:71:24: error: expected constructor, destructor, or type conversion before ';' token
   71 |    condition_variable();
      |                        ^
p1726.cpp:74:22: error: expected constructor, destructor, or type conversion before ';' token
   74 | ~condition_variable();
      |                      ^
p1726.cpp:80:6: error: variable or field 'wait' declared void
   80 | void wait(unique_lock<mutex>& lock);
      |      ^~~~
p1726.cpp:80:11: error: 'unique_lock' was not declared in this scope
   80 | void wait(unique_lock<mutex>& lock);
      |           ^~~~~~~~~~~
p1726.cpp:80:11: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:80:28: error: expected primary-expression before '>' token
   80 | void wait(unique_lock<mutex>& lock);
      |                            ^
p1726.cpp:80:31: error: 'lock' was not declared in this scope
   80 | void wait(unique_lock<mutex>& lock);
      |                               ^~~~
p1726.cpp:80:31: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:90:8: error: variable or field 'wait' declared void
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |        ^~~~
p1726.cpp:90:13: error: 'unique_lock' was not declared in this scope
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |             ^~~~~~~~~~~
p1726.cpp:90:13: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:90:30: error: expected primary-expression before '>' token
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                              ^
p1726.cpp:90:33: error: 'lock' was not declared in this scope
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                 ^~~~
p1726.cpp:90:33: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:90:49: error: expected primary-expression before 'pred'
   90 |   void wait(unique_lock<mutex>& lock, Predicate pred);
      |                                                 ^~~~
p1726.cpp:95:5: error: expected constructor, destructor, or type conversion before '(' token
   95 | wait(lock);
      |     ^
p1726.cpp:99:13: error: redefinition of 'template<class Clock, class Duration> std::cv_status wait_until'
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:56:13: note: 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>' previously declared here
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:99:24: error: 'unique_lock' was not declared in this scope
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                        ^~~~~~~~~~~
p1726.cpp:99:24: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:99:41: error: expected primary-expression before '>' token
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                         ^
p1726.cpp:99:44: error: 'lock' was not declared in this scope
   99 |   cv_status wait_until(unique_lock<mutex>& lock,
      |                                            ^~~~
p1726.cpp:99:44: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:100:19: error: expected primary-expression before 'const'
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                   ^~~~~
p1726.cpp:100:59: error: expected primary-expression before '>' token
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                                                           ^
p1726.cpp:100:62: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
  100 |                   const chrono::time_point<Clock, Duration>& abs_time);
      |                                                              ^~~~~~~~
      |                                                              asctime
p1726.cpp:112:13: error: redefinition of 'template<class Rep, class Period> std::cv_status wait_for'
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:63:13: note: 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>' previously declared here
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:112:22: error: 'unique_lock' was not declared in this scope
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                      ^~~~~~~~~~~
p1726.cpp:112:22: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:112:39: error: expected primary-expression before '>' token
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                       ^
p1726.cpp:112:42: error: 'lock' was not declared in this scope
  112 |   cv_status wait_for(unique_lock<mutex>& lock,
      |                                          ^~~~
p1726.cpp:112:42: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:113:17: error: expected primary-expression before 'const'
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                 ^~~~~
p1726.cpp:113:51: error: expected primary-expression before '>' token
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                                                   ^
p1726.cpp:113:54: error: 'rel_time' was not declared in this scope
  113 |                 const chrono::duration<Rep, Period>& rel_time);
      |                                                      ^~~~~~~~
p1726.cpp:118:1: error: expected unqualified-id before 'return'
  118 | return wait_until(lock, chrono::steady_clock::now() + rel_time);
      | ^~~~~~
p1726.cpp:127:19: error: redeclaration of 'template<class Clock, class Duration, class Predicate> bool wait_until'
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:56:13: note: previous declaration 'template<class Clock, class Duration> std::cv_status wait_until<Clock, Duration>'
   56 |   cv_status wait_until(unique_lock<mutex>& lock,
      |             ^~~~~~~~~~
p1726.cpp:127:19: error: 'unique_lock' was not declared in this scope
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                   ^~~~~~~~~~~
p1726.cpp:127:19: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:127:36: error: expected primary-expression before '>' token
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                                    ^
p1726.cpp:127:39: error: 'lock' was not declared in this scope
  127 |   bool wait_until(unique_lock<mutex>& lock,
      |                                       ^~~~
p1726.cpp:127:39: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:128:14: error: expected primary-expression before 'const'
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |              ^~~~~
p1726.cpp:128:54: error: expected primary-expression before '>' token
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |                                                      ^
p1726.cpp:128:57: error: 'abs_time' was not declared in this scope; did you mean 'asctime'?
  128 |              const chrono::time_point<Clock, Duration>& abs_time,
      |                                                         ^~~~~~~~
      |                                                         asctime
p1726.cpp:129:24: error: expected primary-expression before 'pred'
  129 |              Predicate pred);
      |                        ^~~~
p1726.cpp:129:28: error: expression list treated as compound expression in initializer [-fpermissive]
  129 |              Predicate pred);
      |                            ^
p1726.cpp:134:3: error: expected unqualified-id before 'while'
  134 |   while (!pred())
      |   ^~~~~
p1726.cpp:137:3: error: expected unqualified-id before 'return'
  137 |   return true;
      |   ^~~~~~
p1726.cpp:143:17: error: redeclaration of 'template<class Rep, class Period, class Predicate> bool wait_for'
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:63:13: note: previous declaration 'template<class Rep, class Period> std::cv_status wait_for<Rep, Period>'
   63 |   cv_status wait_for(unique_lock<mutex>& lock,
      |             ^~~~~~~~
p1726.cpp:143:17: error: 'unique_lock' was not declared in this scope
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                 ^~~~~~~~~~~
p1726.cpp:143:17: note: 'std::unique_lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:143:34: error: expected primary-expression before '>' token
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                                  ^
p1726.cpp:143:37: error: 'lock' was not declared in this scope
  143 |   bool wait_for(unique_lock<mutex>& lock,
      |                                     ^~~~
p1726.cpp:143:37: note: 'std::lock' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
p1726.cpp:144:12: error: expected primary-expression before 'const'
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |            ^~~~~
p1726.cpp:144:46: error: expected primary-expression before '>' token
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                              ^
p1726.cpp:144:49: error: 'rel_time' was not declared in this scope
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                 ^~~~~~~~
p1726.cpp:144:79: error: expected primary-expression before 'pred'
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                                               ^~~~
p1726.cpp:144:83: error: expression list treated as compound expression in initializer [-fpermissive]
  144 |            const chrono::duration<Rep, Period>& rel_time,           Predicate pred);
      |                                                                                   ^
p1726.cpp:149:1: error: expected unqualified-id before 'return'
  149 | return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
      | ^~~~~~
p1726.cpp:165:19: error: 'Lock' has not been declared
  165 |         void wait(Lock& lock);
      |                   ^~~~
p1726.cpp:169:48: error: 'chrono' does not name a type
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                ^~~~~~
p1726.cpp:169:66: error: expected unqualified-id before '<' token
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                                  ^
p1726.cpp:169:66: error: expected ')' before '<' token
  169 |         cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                             ~                                    ^
      |                                                                  )
p1726.cpp:169:66: error: expected initializer before '<' token
p1726.cpp:171:43: error: 'chrono' does not name a type
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                                           ^~~~~~
p1726.cpp:171:61: error: expected unqualified-id before '<' token
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                                                             ^
p1726.cpp:171:61: error: expected ')' before '<' token
  171 |         bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time,
      |                        ~                                    ^
      |                                                             )
p1726.cpp:171:61: error: expected initializer before '<' token
p1726.cpp:174:46: error: 'chrono' does not name a type
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                              ^~~~~~
p1726.cpp:174:62: error: expected unqualified-id before '<' token
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                                              ^
p1726.cpp:174:62: error: expected ')' before '<' token
  174 |         cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                           ~                                  ^
      |                                                              )
p1726.cpp:174:62: error: expected initializer before '<' token
p1726.cpp:176:41: error: 'chrono' does not name a type
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                         ^~~~~~
p1726.cpp:176:57: error: expected unqualified-id before '<' token
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                                         ^
p1726.cpp:176:57: error: expected ')' before '<' token
  176 |         bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                      ~                                  ^
      |                                                         )
p1726.cpp:176:57: error: expected initializer before '<' token
p1726.cpp:178:19: error: 'Lock' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                   ^~~~
p1726.cpp:178:31: error: 'stop_token' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                               ^~~~~~~~~~
p1726.cpp:178:50: error: 'Predicate' has not been declared
  178 |         bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                                                  ^~~~~~~~~
p1726.cpp:180:37: error: 'stop_token' has not been declared
  180 |         bool wait_until(Lock& lock, stop_token stoken,
      |                                     ^~~~~~~~~~
p1726.cpp:181:31: error: 'chrono' does not name a type
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                               ^~~~~~
p1726.cpp:181:49: error: expected unqualified-id before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
p1726.cpp:181:49: error: expected ')' before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
      |                                                 )
p1726.cpp:180:24: note: to match this '('
  180 |         bool wait_until(Lock& lock, stop_token stoken,
      |                        ^
p1726.cpp:181:49: error: expected initializer before '<' token
  181 |                         const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                 ^
p1726.cpp:183:35: error: 'stop_token' has not been declared
  183 |         bool wait_for(Lock& lock, stop_token stoken,
      |                                   ^~~~~~~~~~
p1726.cpp:184:29: error: 'chrono' does not name a type
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                             ^~~~~~
p1726.cpp:184:45: error: expected unqualified-id before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
p1726.cpp:184:45: error: expected ')' before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
      |                                             )
p1726.cpp:183:22: note: to match this '('
  183 |         bool wait_for(Lock& lock, stop_token stoken,
      |                      ^
p1726.cpp:184:45: error: expected initializer before '<' token
  184 |                       const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                             ^
p1726.cpp:186:25: error: expected constructor, destructor, or type conversion before ';' token
  186 | condition_variable_any();
      |                         ^
p1726.cpp:190:26: error: expected constructor, destructor, or type conversion before ';' token
  190 | ~condition_variable_any();
      |                          ^
p1726.cpp:208:5: error: expected constructor, destructor, or type conversion before '(' token
  208 | wait(lock);
      |     ^
p1726.cpp:210:42: error: 'chrono' does not name a type
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^~~~~~
p1726.cpp:210:60: error: expected unqualified-id before '<' token
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                                                            ^
p1726.cpp:210:60: error: expected ')' before '<' token
  210 |   cv_status wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
      |                       ~                                    ^
      |                                                            )
p1726.cpp:210:60: error: expected initializer before '<' token
p1726.cpp:219:40: error: 'chrono' does not name a type
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                        ^~~~~~
p1726.cpp:219:56: error: expected unqualified-id before '<' token
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                                                        ^
p1726.cpp:219:56: error: expected ')' before '<' token
  219 |   cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
      |                     ~                                  ^
      |                                                        )
p1726.cpp:219:56: error: expected initializer before '<' token
p1726.cpp:221:1: error: expected unqualified-id before 'return'
  221 | return wait_until(lock, chrono::steady_clock::now() + rel_time);
      | ^~~~~~
p1726.cpp:227:37: error: 'chrono' does not name a type
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                     ^~~~~~
p1726.cpp:227:55: error: expected unqualified-id before '<' token
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                                       ^
p1726.cpp:227:55: error: expected ')' before '<' token
  227 |   bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                  ~                                    ^
      |                                                       )
p1726.cpp:227:55: error: expected initializer before '<' token
p1726.cpp:230:3: error: expected unqualified-id before 'while'
  230 |   while (!stoken.stop_requested()) {
      |   ^~~~~
p1726.cpp:235:3: error: expected unqualified-id before 'return'
  235 |   return pred();
      |   ^~~~~~
p1726.cpp:240:3: error: expected unqualified-id before 'while'
  240 |   while (!pred())
      |   ^~~~~
p1726.cpp:243:3: error: expected unqualified-id before 'return'
  243 |   return true;
      |   ^~~~~~
p1726.cpp:247:28: error: 'stop_token' has not been declared
  247 |      bool wait(Lock& lock, stop_token stoken, Predicate pred);
      |                            ^~~~~~~~~~
p1726.cpp:249:33: error: 'chrono' does not name a type
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                 ^~~~~~
p1726.cpp:249:49: error: expected unqualified-id before '<' token
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                                 ^
p1726.cpp:249:49: error: expected ')' before '<' token
  249 | bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |              ~                                  ^
      |                                                 )
p1726.cpp:249:49: error: expected initializer before '<' token
p1726.cpp:251:1: error: expected unqualified-id before 'return'
  251 | return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
      | ^~~~~~
p1726.cpp:254:31: error: 'stop_token' has not been declared
  254 |   bool wait_until(Lock& lock, stop_token stoken,
      |                               ^~~~~~~~~~
p1726.cpp:255:20: error: 'chrono' does not name a type
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                    ^~~~~~
p1726.cpp:255:38: error: expected unqualified-id before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
p1726.cpp:255:38: error: expected ')' before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
      |                                      )
p1726.cpp:254:18: note: to match this '('
  254 |   bool wait_until(Lock& lock, stop_token stoken,
      |                  ^
p1726.cpp:255:38: error: expected initializer before '<' token
  255 |              const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
      |                                      ^
p1726.cpp:257:3: error: expected unqualified-id before 'while'
  257 |   while (!stoken.stop_requested()) {
      |   ^~~~~
p1726.cpp:263:1: error: expected unqualified-id before 'return'
  263 | return pred();
      | ^~~~~~
p1726.cpp:269:29: error: 'stop_token' has not been declared
  269 |   bool wait_for(Lock& lock, stop_token stoken,
      |                             ^~~~~~~~~~
p1726.cpp:270:23: error: 'chrono' does not name a type
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                       ^~~~~~
p1726.cpp:270:39: error: expected unqualified-id before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
p1726.cpp:270:39: error: expected ')' before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
      |                                       )
p1726.cpp:269:16: note: to match this '('
  269 |   bool wait_for(Lock& lock, stop_token stoken,
      |                ^
p1726.cpp:270:39: error: expected initializer before '<' token
  270 |                 const chrono::duration<Rep, Period>& rel_time, Predicate pred);
      |                                       ^
p1726.cpp:272:1: error: expected unqualified-id before 'return'
  272 | return wait_until(lock, std::move(stoken), chrono::steady_clock::now() + rel_time,
      | ^~~~~~

検討事項(agenda)

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

応用例1 AUTOSAR C++

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

Autosar Guidelines C++14 example code compile list

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

応用例2 MISRA C/C++

MISRA C まとめ #include

MISRA C++ 5-0-16

応用例3 CERT C/C++

SEI CERT C++ Coding Standard AA. Bibliography 確認中。

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

応用例4 箱庭 

箱庭もくもく会

第11回 未定

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

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

この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。 
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。 
一(いち)参加データアナリストの、個人的なつぶやきです。

仮想戦略会議「箱庭」

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

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

自己参考資料(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 初稿  20221008

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