LoginSignup
0
0

More than 1 year has passed since last update.

33.4 Threads [thread.threads] C++N4910:2022 (710) p1668.cpp

Posted at

はじめに(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)

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.4 Threads [thread.threads] C++N4910:2022 (710) p1668.cpp

算譜(source code)

p1668.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.4 Threads [thread.threads] C++N4910:2022 (710) p1668.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.4 Threads [thread.threads]
// 33.4.1 General [thread.threads.general]
//  33.4 describes components that can be used to create and manage threads.
// [Note 1: These threads are intended to map one-to-one with operating system threads.
// 3.4.2 Header <thread> synopsis [thread.syn]
#include <compare> // see 17.11.1
namespace std {
// 33.4.3, class thread class thread;
void swap(thread& x, thread& y) noexcept;
// 33.4.4, class jthread class jthread;
// 33.4.5, namespace this_thread 
namespace this_thread {
thread::id get_id() noexcept;
// is invoked (14.6.2).
~stop_callback();
// Effects: Unregisters the callback from the owned stop state, if any. The destructor 
void yield() noexcept;
template<class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
template<class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
}
}
// 33.4.3 Class thread [thread.thread.class]
// 33.4.3.1 General [thread.thread.class.general]
//  The class thread provides a mechanism to create a new thread of execution, to join with a thread (i.e., wait for a thread to complete), and to perform other operations that manage and query the state of a thread. A thread object uniquely represents a particular thread of execution. That representation may be transferred to other thread objects in such a way that no two thread objects simultaneously represent the same thread of execution. A thread of execution is detached when no thread object represents that thread. Objects of class thread can be in a state that does not represent a thread of execution.
// [Note 1: A thread object does not represent a thread of execution after default construction, after being moved from, or after a successful call to detach or join.
namespace std {
class thread {
public:
// 33.4.3.2, class thread::id
    class id;
    using native_handle_type = implementation-defined;
// construct/copy/destroy
// see 33.2.3
    thread() noexcept;
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
    ~thread();
    thread(const thread&) = delete;
    thread(thread&&) noexcept;
    thread& operator=(const thread&) = delete;
    thread& operator=(thread&&) noexcept;
// 33.4.3.6, members
    void swap(thread&) noexcept;
    bool joinable() const noexcept;
    void join();
    void detach();
    id get_id() const noexcept;
    native_handle_type native_handle();
// static members
    static unsigned int hardware_concurrency() noexcept;
};
}
// see 33.2.3
// 33.4.3.2 Class thread::id [thread.thread.id]
namespace std {
class thread::id {
public:
    id() noexcept;
};
bool operator==(thread::id x, thread::id y) noexcept;
strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
template<class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& out, thread::id id);
// hash support
template<class T> struct hash;
template<> struct hash<thread::id>;
}
// An object of type thread::id provides a unique identifier for each thread of execution and a single distinct value for all thread objects that do not represent a thread of execution (33.4.3). Each thread of execution has an associated thread::id object that is not equal to the thread::id object of any other thread of execution and that is not equal to the thread::id object of any thread object that does not represent threads of execution.
// thread::id is a trivially copyable class (11.2). The library may reuse the value of a thread::id of a terminated thread that can no longer be joined.
//  [Note 1: Relational operators allow thread::id objects to be used as keys in associative containers.
id() noexcept;
// Postconditions: The constructed object does not represent a thread of execution.
bool operator==(thread::id x, thread::id y) noexcept;
// Returns: true only if x and y represent the same thread of execution or neither x nor y represents a thread of execution.
strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
// Let P(x,y) be an unspecified total ordering over thread::id as described in 27.8.
// Returns: strong_ordering::less if P (x, y) is true. Otherwise, strong_ordering::greater if P (y, x) is true. Otherwise, strong_ordering::equal.
template<class charT, class traits>
basic_ostream<charT, traits>&
operator<< (basic_ostream<charT, traits>& out, thread::id id);
// Effects: Inserts an unspecified text representation of id into out. For two objects of type thread::id x and y, if x == y the thread::id objects have the same text representation and if x != y the thread::id objects have distinct text representations.
// Returns: out.
template<> struct hash<thread::id>;
// The specialization is enabled (22.10.19).
// 33.4.3.3 Constructors [thread.thread.constr]
thread() noexcept;
// Effects: The object does not represent a thread of execution.
// Postconditions: get_id() == id().
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
// Constraints: remove_cvref_t<F> is not the same type as thread. Mandates: // The following are all true:
// — is_constructible_v<decay_t<F>, F>,
// — (is_constructible_v<decay_t<Args>, Args> && ...), and
// — is_invocable_v<decay_t<F>, decay_t<Args>...>.
// Effects: The new thread of execution executes invoke(auto(std::forward<F>(f)), auto(std::forward<Args>(args))...) with the values produced by auto being materialized (7.3.5) in the constructing thread. Any return value from this invocation is ignored.
// [Note 1: This implies that any exceptions not thrown from the invocation of the copy of f will be thrown in the constructing thread, not the new thread.
// Effects: If joinable(), invokes terminate (14.6.2). Otherwise, has no effects.
// [Note 1: Either implicitly detaching or joining a joinable() thread in its destructor can result in difficult to debug correctness (for detach) or performance (for join) bugs encountered only when an exception is thrown. These bugs can be avoided by ensuring that the destructor is never executed while the thread is still joinable.
~thread();
// If the invocation of invoke terminates with an uncaught exception, terminate is invoked (14.6.2). Synchronization: The completion of the invocation of the constructor synchronizes with the beginning of the invocation of the copy of f.
// Postconditions: get_id() != id(). *this represents the newly started thread. Throws: system_error if unable to start the new thread.
// rror conditions:
// — resource_unavailable_try_again — the system lacked the necessary resources to create another thread, or the system-imposed limit on the number of threads in a process would be exceeded.
thread(thread&& x) noexcept;
// Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the start of construction.
// 33.4.3.4 Destructor [thread.thread.destr]
// 33.4.3.5 Assignment [thread.thread.assign]
thread& operator=(thread&& x) noexcept;
// Effects: If joinable(), invokes terminate (14.6.2). Otherwise, assigns the state of x to *this and sets x to a default constructed state.
// Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the assignment.
// Returns: *this.
// 33.4.3.6 Members [thread.thread.member]
void swap(thread& x) noexcept;
// Effects: Swaps the state of *this and x.
bool joinable() const noexcept;
// Returns: get_id() != id().
void join();
// Effects: Blocks until the thread represented by *this has completed.
// Synchronization: The completion of the thread represented by *this synchronizes with (6.9.2) the corresponding successful join() return.
// [Note 1: Operations on *this are not synchronized. —end note]
// Postconditions: The thread represented by *this has completed. get_id() == id(). Throws: system_error when an exception is required (33.2.2).
// Error conditions:
// — resource_deadlock_would_occur — if deadlock is detected or get_id() == this_thread:: get_id().
// — no_such_process — if the thread is not valid.
// — invalid_argument — if the thread is not joinable.
void detach();
// Effects: The thread represented by *this continues execution without the calling thread blocking. When detach() returns, *this no longer represents the possibly continuing thread of execution. When the thread previously represented by *this ends execution, the implementation releases any owned resources.
// Postconditions: get_id() == id().
// Throws: system_error when an exception is required (33.2.2). Error conditions:
// — no_such_process — if the thread is not valid.
// — invalid_argument — if the thread is not joinable.
id get_id() const noexcept;
// Returns: A default constructed id object if *this does not represent a thread, otherwise this_- thread::get_id() for the thread of execution represented by *this.
// 33.4.3.7 Static members [thread.thread.static]
unsigned hardware_concurrency() noexcept;
// Returns: The number of hardware thread contexts.
// [Note 1: This value should only be considered to be a hint. —end note]
// If this value is not computable or well-defined, an implementation should return 0.
// 33.4.3.8 Specialized algorithms [thread.thread.algorithm]
void swap(thread& x, thread& y) noexcept;
// Effects: As if by x.swap(y).
// 33.4.4 Class jthread [thread.jthread.class]
// 33.4.4.1 General [thread.jthread.class.general]
//  The class jthread provides a mechanism to create a new thread of execution. The functionality is the same as for class thread (33.4.3) with the additional abilities to provide a stop_token (33.3) to the new thread of execution, make stop requests, and automatically join.
namespace std {
class jthread {
public:
// types
    using id = thread::id;
    using native_handle_type = thread::native_handle_type;
// 33.4.4.2, constructors, move, and assignment
    jthread() noexcept;
    template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
    ~jthread();
    jthread(const jthread&) = delete;
    jthread(jthread&&) noexcept;
    jthread& operator=(const jthread&) = delete;
    jthread& operator=(jthread&&) noexcept;
// 33.4.4.3, members
    void swap(jthread&) noexcept;
    [[nodiscard]] bool joinable() const noexcept;
    void join();
    void detach();
    [[nodiscard]] id get_id() const noexcept;
    [[nodiscard]] native_handle_type native_handle();
// see 33.2.3
// Effects: Constructs a jthread object that does not represent a thread of execution. Postconditions: get_id() == id() is true and ssource.stop_possible() is false.
// Constraints: remove_cvref_t<F> is not the same type as jthread. Mandates: The following are all true:
// — is_constructible_v<decay_t<F>, F>,
// — (is_constructible_v<decay_t<Args>, Args> && ...), and
// — is_invocable_v<decay_t<F>, decay_t<Args>...> || is_invocable_v<decay_t<F>, stop_token, decay_t<Args>...>.
// Effects: Initializes ssource. The new thread of execution executes invoke(auto(std::forward<F>(f)), get_stop_token(),
    auto(std::forward<Args>(args))...)
    if that expression is well-formed, otherwise
    invoke(auto(std::forward<F>(f)), auto(std::forward<Args>(args))...)
// with the values produced by auto being materialized (7.3.5) in the constructing thread. Any return value from this invocation is ignored.
// [Note 1: This implies that any exceptions not thrown from the invocation of the copy of f will be thrown in the constructing thread, not the new thread.
// If the invoke expression exits via an exception, terminate is called.
// Synchronization: The completion of the invocation of the constructor synchronizes with the beginning of the invocation of the copy of f.
// Postconditions: get_id() != id() is true and ssource.stop_possible() is true and *this repre-sents the newly started thread.
// [Note 2: The calling thread can make a stop request only once, because it cannot replace this stop token.
// Throws: system_error if unable to start the new thread. Error conditions:
// — resource_unavailable_try_again — the system lacked the necessary resources to create another thread, or the system-imposed limit on the number of threads in a process would be exceeded.
// 33.4.4.4, stop token handling
        [[nodiscard]] stop_source get_stop_source() noexcept;
        [[nodiscard]] stop_token get_stop_token() const noexcept;
        bool request_stop() noexcept;
// 33.4.4.5, specialized algorithms
        friend void swap(jthread& lhs, jthread& rhs) noexcept;
// 33.4.4.6, static members
        [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
        private:
            stop_source ssource; // exposition only
        };
}
// 3.4.4.2 Constructors, move, and assignment [thread.jthread.cons]
jthread() noexcept;
template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
jthread(jthread&& x) noexcept;
// Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the start of construction. ssource has the value of x.ssource prior to the start of construction and x.ssource.stop_possible() is false.
~jthread();
// Effects: If joinable() is true, calls request_stop() and then join().
// [Note 3: Operations on *this are not synchronized.
jthread& operator=(jthread&& x) noexcept;
// Effects: If joinable() is true, calls request_stop() and then join(). Assigns the state of x to *this and sets x to a default constructed state.
// Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the assignment. ssource has the value of x.ssource prior to the assignment and x.ssource.stop_- possible() is false.
// Returns: *this.
// 33.4.4.3 Members [thread.jthread.mem]
void swap(jthread& x) noexcept;
// Effects: Exchanges the values of *this and x.
[[nodiscard]] bool joinable() const noexcept;
// Returns: get_id() != id().
void join();
// Effects: Blocks until the thread represented by *this has completed.
// Synchronization: The completion of the thread represented by *this synchronizes with (6.9.2) the corresponding successful join() return.
// [Note 1: Operations on *this are not synchronized.
// Postconditions: The thread represented by *this has completed. get_id() == id(). Throws: system_error when an exception is required (33.2.2).
// Error conditions:
// — resource_deadlock_would_occur — if deadlock is detected or get_id() == this_thread:: get_id().
// — no_such_process — if the thread is not valid.
// — invalid_argument — if the thread is not joinable.
void detach();
// Effects: The thread represented by *this continues execution without the calling thread blocking. When detach() returns, *this no longer represents the possibly continuing thread of execution. When the thread previously represented by *this ends execution, the implementation releases any owned resources.
// Postconditions: get_id() == id().
// Throws: system_error when an exception is required (33.2.2). Error conditions:
// — no_such_process — if the thread is not valid.
// — invalid_argument — if the thread is not joinable.
id get_id() const noexcept;
// Returns: A default constructed id object if *this does not represent a thread, otherwise this_- thread::get_id() for the thread of execution represented by *this.
// 33.4.4.4 Stop token handling [thread.jthread.stop]
[[nodiscard]] stop_source get_stop_source() noexcept;
// Effects: Equivalent to: return ssource;
[[nodiscard]] stop_token get_stop_token() const noexcept;
// Effects: Equivalent to:
return ssource.get_token();
bool request_stop() noexcept;
//Returns: An object of type thread::id that uniquely identifies the current thread of execution. No other thread of execution has this id and this thread of execution always has this id. The object returned does not compare equal to a default constructed thread::id.
// Effects: Equivalent to:
return ssource.request_stop();
// 33.4.4.5 Specialized algorithms
friend void swap(jthread& x, jthread& y) noexcept;
// [thread.jthread.special]
// [thread.jthread.static]
// [thread.thread.this]
// Effects: Equivalent to: x.swap(y).
// 33.4.4.6 Static members
[[nodiscard]] static unsigned int hardware_concurrency() noexcept;
// Returns: thread::hardware_concurrency(). 33.4.5 Namespace this_thread
namespace std::this_thread {
thread::id get_id() noexcept;
void yield() noexcept;
template<class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
template<class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
}
thread::id this_thread::get_id() noexcept;
void this_thread::yield() noexcept;
// Effects: Offers the implementation the opportunity to reschedule. // // Synchronization: None.
template<class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
// Effects: Blocks the calling thread for the absolute timeout (33.2.4) specified by abs_time. Synchronization: None.
// Throws: Timeout-related exceptions (33.2.4).
template<class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
// Effects: Blocks the calling thread for the relative timeout (33.2.4) specified by rel_time. Synchronization: None.
// Throws: Timeout-related exceptions (33.2.4).
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

bash
$ clang++ p1668.cpp -std=03 -o p1668l -I. -Wall
In file included from p1668.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 \
 ^
p1668.cpp:22:11: error: use of undeclared identifier 'thread'; did you mean 'fread'?
void swap(thread& x, thread& y) noexcept;
          ^~~~~~
          fread
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:113:11: note: 'fread' declared here
  using ::fread;
          ^
p1668.cpp:22:6: error: variable has incomplete type 'void'
void swap(thread& x, thread& y) noexcept;
     ^
p1668.cpp:22:19: error: use of undeclared identifier 'x'
void swap(thread& x, thread& y) noexcept;
                  ^
p1668.cpp:22:22: error: use of undeclared identifier 'thread'
void swap(thread& x, thread& y) noexcept;
                     ^
p1668.cpp:22:30: error: use of undeclared identifier 'y'
void swap(thread& x, thread& y) noexcept;
                             ^
p1668.cpp:22:32: error: expected ';' after top level declarator
void swap(thread& x, thread& y) noexcept;
                               ^
                               ;
p1668.cpp:26:1: error: use of undeclared identifier 'thread'
thread::id get_id() noexcept;
^
p1668.cpp:26:21: error: expected function body after function declarator
thread::id get_id() noexcept;
                    ^
p1668.cpp:28:2: error: undeclared identifier 'stop_callback' in destructor name
~stop_callback();
 ^
p1668.cpp:30:14: error: expected function body after function declarator
void yield() noexcept;
             ^
p1668.cpp:32:24: error: use of undeclared identifier 'chrono'
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
                       ^
p1668.cpp:34:22: error: use of undeclared identifier 'chrono'
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
                     ^
p1668.cpp:46:32: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using native_handle_type = implementation-defined;
                               ^
p1668.cpp:46:32: error: unknown type name 'implementation'
p1668.cpp:46:46: error: expected ';' after alias declaration
    using native_handle_type = implementation-defined;
                                             ^
                                             ;
p1668.cpp:49:13: error: expected ';' at end of declaration list
    thread() noexcept;
            ^
            ;
p1668.cpp:50:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                           ^
p1668.cpp:50:55: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                      ^
p1668.cpp:50:65: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                                ^
p1668.cpp:52:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    thread(const thread&) = delete;
                            ^
p1668.cpp:53:18: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    thread(thread&&) noexcept;
                 ^
p1668.cpp:53:21: error: expected ';' at end of declaration list
    thread(thread&&) noexcept;
                    ^
                    ;
p1668.cpp:54:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    thread& operator=(const thread&) = delete;
                                       ^
p1668.cpp:55:29: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    thread& operator=(thread&&) noexcept;
                            ^
p1668.cpp:55:32: error: expected ';' at end of declaration list
    thread& operator=(thread&&) noexcept;
                               ^
                               ;
p1668.cpp:57:23: error: expected ';' at end of declaration list
    void swap(thread&) noexcept;
                      ^
                      ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
8 warnings and 20 errors generated.
$ clang++ p1668.cpp -std=2b -o p1668l -I. -Wall
p1668.cpp:22:11: error: use of undeclared identifier 'thread'; did you mean 'fread'?
void swap(thread& x, thread& y) noexcept;
          ^~~~~~
          fread
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:113:11: note: 'fread' declared here
  using ::fread;
          ^
p1668.cpp:22:6: error: variable has incomplete type 'void'
void swap(thread& x, thread& y) noexcept;
     ^
p1668.cpp:22:19: error: use of undeclared identifier 'x'
void swap(thread& x, thread& y) noexcept;
                  ^
p1668.cpp:22:22: error: use of undeclared identifier 'thread'
void swap(thread& x, thread& y) noexcept;
                     ^
p1668.cpp:22:30: error: use of undeclared identifier 'y'
void swap(thread& x, thread& y) noexcept;
                             ^
p1668.cpp:22:32: error: expected ';' after top level declarator
void swap(thread& x, thread& y) noexcept;
                               ^
                               ;
p1668.cpp:26:1: error: use of undeclared identifier 'thread'
thread::id get_id() noexcept;
^
p1668.cpp:28:2: error: undeclared identifier 'stop_callback' in destructor name
~stop_callback();
 ^
p1668.cpp:32:24: error: use of undeclared identifier 'chrono'
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
                       ^
p1668.cpp:34:22: error: use of undeclared identifier 'chrono'
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
                     ^
p1668.cpp:46:32: error: unknown type name 'implementation'
    using native_handle_type = implementation-defined;
                               ^
p1668.cpp:46:46: error: expected ';' after alias declaration
    using native_handle_type = implementation-defined;
                                             ^
                                             ;
p1668.cpp:62:5: error: unknown type name 'native_handle_type'
    native_handle_type native_handle();
    ^
p1668.cpp:86:1: error: C++ requires a type specifier for all declarations
id() noexcept;
^
p1668.cpp:101:8: error: expected unqualified-id
thread() noexcept;
       ^
p1668.cpp:104:51: error: expected ')'
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                  ^
p1668.cpp:104:49: note: to match this '('
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                ^
p1668.cpp:104:34: error: 'explicit' can only appear on non-static member functions
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                 ^
p1668.cpp:113:1: error: destructor must be a non-static member function
~thread();
^
p1668.cpp:118:14: error: expected ')'
thread(thread&& x) noexcept;
             ^
p1668.cpp:118:7: note: to match this '('
thread(thread&& x) noexcept;
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1668.cpp -std=03 -o p1668g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1668.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 \
      |  ^~~~~
p1668.cpp:22:33: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   22 | void swap(thread& x, thread& y) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:22:6: error: variable or field 'swap' declared void
   22 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:22:11: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:22:11: note: 'std::thread' is only available from C++11 onwards
p1668.cpp:22:19: error: 'x' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:22:22: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:22:22: note: 'std::thread' is only available from C++11 onwards
p1668.cpp:22:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   22 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:26:1: error: 'thread' does not name a type; did you mean 'pthread_t'?
   26 | thread::id get_id() noexcept;
      | ^~~~~~
      | pthread_t
p1668.cpp:28:15: error: expected class-name before '(' token
   28 | ~stop_callback();
      |               ^
p1668.cpp:30:14: error: expected initializer before 'noexcept'
   30 | void yield() noexcept;
      |              ^~~~~~~~
p1668.cpp:32:24: error: 'chrono' does not name a type
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:32:42: error: expected unqualified-id before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:32:42: error: expected ')' before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:32:42: error: expected initializer before '<' token
p1668.cpp:34:22: error: 'chrono' does not name a type
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:34:38: error: expected unqualified-id before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:34:38: error: expected ')' before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:34:38: error: expected initializer before '<' token
p1668.cpp:46:11: error: expected nested-name-specifier before 'native_handle_type'
   46 |     using native_handle_type = implementation-defined;
      |           ^~~~~~~~~~~~~~~~~~
p1668.cpp:49:12: error: expected ';' at end of member declaration
   49 |     thread() noexcept;
      |            ^
      |             ;
p1668.cpp:49:14: error: 'noexcept' does not name a type
   49 |     thread() noexcept;
      |              ^~~~~~~~
p1668.cpp:49:14: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:50:28: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   50 |     template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                            ^~~
p1668.cpp:50:55: error: expected ',' or '...' before '&&' token
   50 |     template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                                       ^~
p1668.cpp:52:29: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   52 |     thread(const thread&) = delete;
      |                             ^~~~~~
p1668.cpp:53:18: error: expected ',' or '...' before '&&' token
   53 |     thread(thread&&) noexcept;
      |                  ^~
p1668.cpp:53:5: error: invalid constructor; you probably meant 'std::thread (const std::thread&)'
   53 |     thread(thread&&) noexcept;
      |     ^~~~~~
p1668.cpp:53:20: error: expected ';' at end of member declaration
   53 |     thread(thread&&) noexcept;
      |                    ^
      |                     ;
p1668.cpp:53:22: error: 'noexcept' does not name a type
   53 |     thread(thread&&) noexcept;
      |                      ^~~~~~~~
p1668.cpp:53:22: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:54:40: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   54 |     thread& operator=(const thread&) = delete;
      |                                        ^~~~~~
p1668.cpp:55:29: error: expected ',' or '...' before '&&' token
   55 |     thread& operator=(thread&&) noexcept;
      |                             ^~
p1668.cpp:55:31: error: expected ';' at end of member declaration
   55 |     thread& operator=(thread&&) noexcept;
      |                               ^
      |                                ;
p1668.cpp:55:33: error: 'noexcept' does not name a type
   55 |     thread& operator=(thread&&) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:55:33: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:57:22: error: expected ';' at end of member declaration
   57 |     void swap(thread&) noexcept;
      |                      ^
      |                       ;
p1668.cpp:57:24: error: 'noexcept' does not name a type
   57 |     void swap(thread&) noexcept;
      |                        ^~~~~~~~
p1668.cpp:57:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:58:21: error: expected ';' at end of member declaration
   58 |     bool joinable() const noexcept;
      |                     ^~~~~
      |                          ;
p1668.cpp:58:27: error: 'noexcept' does not name a type
   58 |     bool joinable() const noexcept;
      |                           ^~~~~~~~
p1668.cpp:58:27: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:61:17: error: expected ';' at end of member declaration
   61 |     id get_id() const noexcept;
      |                 ^~~~~
      |                      ;
p1668.cpp:61:23: error: 'noexcept' does not name a type
   61 |     id get_id() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:61:23: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:62:5: error: 'native_handle_type' does not name a type
   62 |     native_handle_type native_handle();
      |     ^~~~~~~~~~~~~~~~~~
p1668.cpp:64:46: error: expected ';' at end of member declaration
   64 |     static unsigned int hardware_concurrency() noexcept;
      |                                              ^
      |                                               ;
p1668.cpp:64:48: error: 'noexcept' does not name a type
   64 |     static unsigned int hardware_concurrency() noexcept;
      |                                                ^~~~~~~~
p1668.cpp:64:48: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:72:8: error: expected ';' at end of member declaration
   72 |     id() noexcept;
      |        ^
      |         ;
p1668.cpp:72:10: error: 'noexcept' does not name a type
   72 |     id() noexcept;
      |          ^~~~~~~~
p1668.cpp:72:10: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:74:45: error: expected initializer before 'noexcept'
   74 | bool operator==(thread::id x, thread::id y) noexcept;
      |                                             ^~~~~~~~
p1668.cpp:75:1: error: 'strong_ordering' does not name a type
   75 | strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
      | ^~~~~~~~~~~~~~~
p1668.cpp:86:6: error: expected constructor, destructor, or type conversion before 'noexcept'
   86 | id() noexcept;
      |      ^~~~~~~~
p1668.cpp:88:45: error: expected initializer before 'noexcept'
   88 | bool operator==(thread::id x, thread::id y) noexcept;
      |                                             ^~~~~~~~
p1668.cpp:90:1: error: 'strong_ordering' does not name a type
   90 | strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
      | ^~~~~~~~~~~~~~~
p1668.cpp:98:19: error: explicit specialization of 'template<class T> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive]
   98 | template<> struct hash<thread::id>;
      |                   ^~~~~~~~~~~~~~~~
p1668.cpp:101:8: error: expected unqualified-id before ')' token
  101 | thread() noexcept;
      |        ^
p1668.cpp:104:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                        ^~~
p1668.cpp:104:51: error: expected ')' before '&&' token
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                                 ~ ^~
      |                                                   )
p1668.cpp:113:10: error: expected constructor, destructor, or type conversion before ';' token
  113 | ~thread();
      |          ^
p1668.cpp:118:14: error: expected ')' before '&&' token
  118 | thread(thread&& x) noexcept;
      |       ~      ^~
      |              )
p1668.cpp:122:25: error: expected ',' or '...' before '&&' token
  122 | thread& operator=(thread&& x) noexcept;
      |                         ^~
p1668.cpp:122:31: error: expected initializer before 'noexcept'
  122 | thread& operator=(thread&& x) noexcept;
      |                               ^~~~~~~~
p1668.cpp:127:22: error: expected initializer before 'noexcept'
  127 | void swap(thread& x) noexcept;
      |                      ^~~~~~~~
p1668.cpp:129:23: error: expected initializer before 'noexcept'
  129 | bool joinable() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:146:1: error: 'id' does not name a type; did you mean 'void'?
  146 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:149:33: error: expected initializer before 'noexcept'
  149 | unsigned hardware_concurrency() noexcept;
      |                                 ^~~~~~~~
p1668.cpp:154:33: error: expected initializer before 'noexcept'
  154 | void swap(thread& x, thread& y) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:163:11: error: expected nested-name-specifier before 'id'
  163 |     using id = thread::id;
      |           ^~
p1668.cpp:164:11: error: expected nested-name-specifier before 'native_handle_type'
  164 |     using native_handle_type = thread::native_handle_type;
      |           ^~~~~~~~~~~~~~~~~~
p1668.cpp:166:13: error: expected ';' at end of member declaration
  166 |     jthread() noexcept;
      |             ^
      |              ;
p1668.cpp:166:15: error: 'noexcept' does not name a type
  166 |     jthread() noexcept;
      |               ^~~~~~~~
p1668.cpp:166:15: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:167:28: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  167 |     template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                            ^~~
p1668.cpp:167:56: error: expected ',' or '...' before '&&' token
  167 |     template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                                        ^~
p1668.cpp:169:31: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  169 |     jthread(const jthread&) = delete;
      |                               ^~~~~~
p1668.cpp:170:20: error: expected ',' or '...' before '&&' token
  170 |     jthread(jthread&&) noexcept;
      |                    ^~
p1668.cpp:170:5: error: invalid constructor; you probably meant 'std::jthread (const std::jthread&)'
  170 |     jthread(jthread&&) noexcept;
      |     ^~~~~~~
p1668.cpp:170:22: error: expected ';' at end of member declaration
  170 |     jthread(jthread&&) noexcept;
      |                      ^
      |                       ;
p1668.cpp:170:24: error: 'noexcept' does not name a type
  170 |     jthread(jthread&&) noexcept;
      |                        ^~~~~~~~
p1668.cpp:170:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:171:42: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  171 |     jthread& operator=(const jthread&) = delete;
      |                                          ^~~~~~
p1668.cpp:172:31: error: expected ',' or '...' before '&&' token
  172 |     jthread& operator=(jthread&&) noexcept;
      |                               ^~
p1668.cpp:172:33: error: expected ';' at end of member declaration
  172 |     jthread& operator=(jthread&&) noexcept;
      |                                 ^
      |                                  ;
p1668.cpp:172:35: error: 'noexcept' does not name a type
  172 |     jthread& operator=(jthread&&) noexcept;
      |                                   ^~~~~~~~
p1668.cpp:172:35: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:174:23: error: expected ';' at end of member declaration
  174 |     void swap(jthread&) noexcept;
      |                       ^
      |                        ;
p1668.cpp:174:25: error: 'noexcept' does not name a type
  174 |     void swap(jthread&) noexcept;
      |                         ^~~~~~~~
p1668.cpp:174:25: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:175:5: error: expected unqualified-id before '[' token
  175 |     [[nodiscard]] bool joinable() const noexcept;
      |     ^
p1668.cpp:178:5: error: expected unqualified-id before '[' token
  178 |     [[nodiscard]] id get_id() const noexcept;
      |     ^
p1668.cpp:179:5: error: expected unqualified-id before '[' token
  179 |     [[nodiscard]] native_handle_type native_handle();
      |     ^
p1668.cpp:187:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  187 |     auto(std::forward<Args>(args))...)
      |     ^~~~
      |     ----
p1668.cpp:187:22: error: expected ')' before '<' token
  187 |     auto(std::forward<Args>(args))...)
      |         ~            ^
      |                      )
p1668.cpp:200:9: error: expected unqualified-id before '[' token
  200 |         [[nodiscard]] stop_token get_stop_token() const noexcept;
      |         ^
p1668.cpp:201:27: error: expected ';' at end of member declaration
  201 |         bool request_stop() noexcept;
      |                           ^
      |                            ;
p1668.cpp:201:29: error: 'noexcept' does not name a type
  201 |         bool request_stop() noexcept;
      |                             ^~~~~~~~
p1668.cpp:201:29: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:203:52: error: expected ';' at end of member declaration
  203 |         friend void swap(jthread& lhs, jthread& rhs) noexcept;
      |                                                    ^
      |                                                     ;
p1668.cpp:203:54: error: 'noexcept' does not name a type
  203 |         friend void swap(jthread& lhs, jthread& rhs) noexcept;
      |                                                      ^~~~~~~~
p1668.cpp:203:54: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:205:9: error: expected unqualified-id before '[' token
  205 |         [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      |         ^
p1668.cpp:207:13: error: 'stop_source' does not name a type
  207 |             stop_source ssource; // exposition only
      |             ^~~~~~~~~~~
p1668.cpp:211:9: error: expected unqualified-id before ')' token
  211 | jthread() noexcept;
      |         ^
p1668.cpp:212:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                        ^~~
p1668.cpp:212:52: error: expected ')' before '&&' token
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                                  ~ ^~
      |                                                    )
p1668.cpp:213:16: error: expected ')' before '&&' token
  213 | jthread(jthread&& x) noexcept;
      |        ~       ^~
      |                )
p1668.cpp:215:11: error: expected constructor, destructor, or type conversion before ';' token
  215 | ~jthread();
      |           ^
p1668.cpp:218:27: error: expected ',' or '...' before '&&' token
  218 | jthread& operator=(jthread&& x) noexcept;
      |                           ^~
p1668.cpp:218:33: error: expected initializer before 'noexcept'
  218 | jthread& operator=(jthread&& x) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:223:23: error: expected initializer before 'noexcept'
  223 | void swap(jthread& x) noexcept;
      |                       ^~~~~~~~
p1668.cpp:225:1: error: expected unqualified-id before '[' token
  225 | [[nodiscard]] bool joinable() const noexcept;
      | ^
p1668.cpp:242:1: error: 'id' does not name a type; did you mean 'void'?
  242 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:245:1: error: expected unqualified-id before '[' token
  245 | [[nodiscard]] stop_source get_stop_source() noexcept;
      | ^
p1668.cpp:247:1: error: expected unqualified-id before '[' token
  247 | [[nodiscard]] stop_token get_stop_token() const noexcept;
      | ^
p1668.cpp:249:1: error: expected unqualified-id before 'return'
  249 | return ssource.get_token();
      | ^~~~~~
p1668.cpp:250:21: error: expected initializer before 'noexcept'
  250 | bool request_stop() noexcept;
      |                     ^~~~~~~~
p1668.cpp:253:1: error: expected unqualified-id before 'return'
  253 | return ssource.request_stop();
      | ^~~~~~
p1668.cpp:255:1: error: 'friend' used outside of class
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      | ^~~~~~
      | ------
p1668.cpp:255:42: error: expected initializer before 'noexcept'
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                                          ^~~~~~~~
p1668.cpp:261:1: error: expected unqualified-id before '[' token
  261 | [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      | ^
p1668.cpp:264:21: error: expected initializer before 'noexcept'
  264 | thread::id get_id() noexcept;
      |                     ^~~~~~~~
p1668.cpp:265:14: error: expected initializer before 'noexcept'
  265 | void yield() noexcept;
      |              ^~~~~~~~
p1668.cpp:267:24: error: 'chrono' does not name a type
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:267:42: error: expected unqualified-id before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:267:42: error: expected ')' before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:267:42: error: expected initializer before '<' token
p1668.cpp:269:22: error: 'chrono' does not name a type
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:269:38: error: expected unqualified-id before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:269:38: error: expected ')' before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:269:38: error: expected initializer before '<' token
p1668.cpp:271:34: error: expected initializer before 'noexcept'
  271 | thread::id this_thread::get_id() noexcept;
      |                                  ^~~~~~~~
p1668.cpp:272:27: error: expected initializer before 'noexcept'
  272 | void this_thread::yield() noexcept;
      |                           ^~~~~~~~
p1668.cpp:275:24: error: 'chrono' does not name a type
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:275:42: error: expected unqualified-id before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:275:42: error: expected ')' before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:275:42: error: expected initializer before '<' token
p1668.cpp:279:22: error: 'chrono' does not name a type
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:279:38: error: expected unqualified-id before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:279:38: error: expected ')' before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:279:38: error: expected initializer before '<' token
p1668.cpp:286:5: error: redefinition of 'int main()'
  286 | int main() {
      |     ^~~~
p1668.cpp:282:5: note: 'int main()' previously defined here
  282 | int main() {
      |     ^~~~

$ g++ p1668.cpp -std=2b -o p1668g -I. -Wall
p1668.cpp:22:6: error: variable or field 'swap' declared void
   22 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:22:11: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:11:1: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
   10 | #include "N4910.h"
  +++ |+#include <thread>
   11 | 
p1668.cpp:22:19: error: 'x' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:22:22: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:22:22: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
p1668.cpp:22:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   22 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:26:1: error: 'thread' does not name a type; did you mean 'pthread_t'?
   26 | thread::id get_id() noexcept;
      | ^~~~~~
      | pthread_t
p1668.cpp:28:15: error: expected class-name before '(' token
   28 | ~stop_callback();
      |               ^
p1668.cpp:32:24: error: 'chrono' does not name a type
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:32:42: error: expected unqualified-id before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:32:42: error: expected ')' before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:32:42: error: expected initializer before '<' token
p1668.cpp:34:22: error: 'chrono' does not name a type
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:34:38: error: expected unqualified-id before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:34:38: error: expected ')' before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:34:38: error: expected initializer before '<' token
p1668.cpp:46:32: error: 'implementation' does not name a type
   46 |     using native_handle_type = implementation-defined;
      |                                ^~~~~~~~~~~~~~
p1668.cpp:62:5: error: 'native_handle_type' does not name a type
   62 |     native_handle_type native_handle();
      |     ^~~~~~~~~~~~~~~~~~
p1668.cpp:86:14: error: expected constructor, destructor, or type conversion before ';' token
   86 | id() noexcept;
      |              ^
p1668.cpp:98:19: error: explicit specialization of 'template<class _Tp> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive]
   98 | template<> struct hash<thread::id>;
      |                   ^~~~~~~~~~~~~~~~
p1668.cpp:101:18: error: expected constructor, destructor, or type conversion before ';' token
  101 | thread() noexcept;
      |                  ^
p1668.cpp:104:43: error: ISO C++ forbids declaration of 'thread' with no type [-fpermissive]
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:104:34: error: 'explicit' outside class declaration
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                  ^~~~~~~~
p1668.cpp:113:10: error: expected constructor, destructor, or type conversion before ';' token
  113 | ~thread();
      |          ^
p1668.cpp:118:7: error: expected constructor, destructor, or type conversion before '(' token
  118 | thread(thread&& x) noexcept;
      |       ^
p1668.cpp:122:1: error: reference to 'thread' is ambiguous
  122 | thread& operator=(thread&& x) noexcept;
      | ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:127:6: error: variable or field 'swap' declared void
  127 | void swap(thread& x) noexcept;
      |      ^~~~
p1668.cpp:127:11: error: reference to 'thread' is ambiguous
  127 | void swap(thread& x) noexcept;
      |           ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:127:19: error: 'x' was not declared in this scope
  127 | void swap(thread& x) noexcept;
      |                   ^
p1668.cpp:129:23: error: non-member function 'bool joinable()' cannot have cv-qualifier
  129 | bool joinable() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:146:1: error: 'id' does not name a type; did you mean 'void'?
  146 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:154:6: error: variable or field 'swap' declared void
  154 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:154:11: error: reference to 'thread' is ambiguous
  154 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:154:19: error: 'x' was not declared in this scope
  154 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:154:22: error: reference to 'thread' is ambiguous
  154 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:154:30: error: 'y' was not declared in this scope; did you mean 'yn'?
  154 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:164:40: error: 'native_handle_type' in 'class std::thread' does not name a type
  164 |     using native_handle_type = thread::native_handle_type;
      |                                        ^~~~~~~~~~~~~~~~~~
p1668.cpp:179:19: error: 'native_handle_type' does not name a type
  179 |     [[nodiscard]] native_handle_type native_handle();
      |                   ^~~~~~~~~~~~~~~~~~
p1668.cpp:187:23: error: 'Args' was not declared in this scope
  187 |     auto(std::forward<Args>(args))...)
      |                       ^~~~
p1668.cpp:187:29: error: 'args' has not been declared
  187 |     auto(std::forward<Args>(args))...)
      |                             ^~~~
p1668.cpp:187:10: error: invalid use of '::'
  187 |     auto(std::forward<Args>(args))...)
      |          ^~~
p1668.cpp:187:34: error: expected ';' at end of member declaration
  187 |     auto(std::forward<Args>(args))...)
      |                                  ^
      |                                   ;
p1668.cpp:187:35: error: expected unqualified-id before '...' token
  187 |     auto(std::forward<Args>(args))...)
      |                                   ^~~
p1668.cpp:200:23: error: 'stop_token' does not name a type
  200 |         [[nodiscard]] stop_token get_stop_token() const noexcept;
      |                       ^~~~~~~~~~
p1668.cpp:207:13: error: 'stop_source' does not name a type
  207 |             stop_source ssource; // exposition only
      |             ^~~~~~~~~~~
p1668.cpp:211:19: error: expected constructor, destructor, or type conversion before ';' token
  211 | jthread() noexcept;
      |                   ^
p1668.cpp:212:43: error: ISO C++ forbids declaration of 'jthread' with no type [-fpermissive]
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:212:34: error: 'explicit' outside class declaration
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                  ^~~~~~~~
p1668.cpp:213:8: error: expected constructor, destructor, or type conversion before '(' token
  213 | jthread(jthread&& x) noexcept;
      |        ^
p1668.cpp:215:11: error: expected constructor, destructor, or type conversion before ';' token
  215 | ~jthread();
      |           ^
p1668.cpp:218:1: error: reference to 'jthread' is ambiguous
  218 | jthread& operator=(jthread&& x) noexcept;
      | ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:223:6: error: variable or field 'swap' declared void
  223 | void swap(jthread& x) noexcept;
      |      ^~~~
p1668.cpp:223:11: error: reference to 'jthread' is ambiguous
  223 | void swap(jthread& x) noexcept;
      |           ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:223:20: error: 'x' was not declared in this scope
  223 | void swap(jthread& x) noexcept;
      |                    ^
p1668.cpp:225:37: error: non-member function 'bool joinable()' cannot have cv-qualifier
  225 | [[nodiscard]] bool joinable() const noexcept;
      |                                     ^~~~~~~~
p1668.cpp:242:1: error: 'id' does not name a type; did you mean 'void'?
  242 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:245:15: error: 'stop_source' does not name a type
  245 | [[nodiscard]] stop_source get_stop_source() noexcept;
      |               ^~~~~~~~~~~
p1668.cpp:247:15: error: 'stop_token' does not name a type
  247 | [[nodiscard]] stop_token get_stop_token() const noexcept;
      |               ^~~~~~~~~~
p1668.cpp:249:1: error: expected unqualified-id before 'return'
  249 | return ssource.get_token();
      | ^~~~~~
p1668.cpp:253:1: error: expected unqualified-id before 'return'
  253 | return ssource.request_stop();
      | ^~~~~~
p1668.cpp:255:1: error: 'friend' used outside of class
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      | ^~~~~~
      | ------
p1668.cpp:255:13: error: variable or field 'swap' declared void
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |             ^~~~
p1668.cpp:255:18: error: reference to 'jthread' is ambiguous
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                  ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:255:27: error: 'x' was not declared in this scope
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                           ^
p1668.cpp:255:30: error: reference to 'jthread' is ambiguous
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                              ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:255:39: error: 'y' was not declared in this scope; did you mean 'yn'?
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                                       ^
      |                                       yn
p1668.cpp:261:35: error: 'unsigned int hardware_concurrency()' was declared 'extern' and later 'static' [-fpermissive]
  261 | [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      |                                   ^~~~~~~~~~~~~~~~~~~~
p1668.cpp:149:10: note: previous declaration of 'unsigned int hardware_concurrency()'
  149 | unsigned hardware_concurrency() noexcept;
      |          ^~~~~~~~~~~~~~~~~~~~
p1668.cpp:267:24: error: 'chrono' does not name a type
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:267:42: error: expected unqualified-id before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:267:42: error: expected ')' before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:267:42: error: expected initializer before '<' token
p1668.cpp:269:22: error: 'chrono' does not name a type
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:269:38: error: expected unqualified-id before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:269:38: error: expected ')' before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:269:38: error: expected initializer before '<' token
p1668.cpp:275:24: error: 'chrono' does not name a type
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:275:42: error: expected unqualified-id before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:275:42: error: expected ')' before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:275:42: error: expected initializer before '<' token
p1668.cpp:279:22: error: 'chrono' does not name a type
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:279:38: error: expected unqualified-id before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:279:38: error: expected ')' before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:279:38: error: expected initializer before '<' token
p1668.cpp:286:5: error: redefinition of 'int main()'
  286 | int main() {
      |     ^~~~
p1668.cpp:282:5: note: 'int main()' previously defined here
  282 | int main() {
      |     ^~~~
root@12564b9d981e:/Users/ogawakiyoshi/n4910# vi p1668.cpp
root@12564b9d981e:/Users/ogawakiyoshi/n4910# ./clgc.sh p1668
$ clang++ p1668.cpp -std=03 -o p1668l -I. -Wall
In file included from p1668.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 \
 ^
p1668.cpp:22:11: error: use of undeclared identifier 'thread'; did you mean 'fread'?
void swap(thread& x, thread& y) noexcept;
          ^~~~~~
          fread
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:113:11: note: 'fread' declared here
  using ::fread;
          ^
p1668.cpp:22:6: error: variable has incomplete type 'void'
void swap(thread& x, thread& y) noexcept;
     ^
p1668.cpp:22:19: error: use of undeclared identifier 'x'
void swap(thread& x, thread& y) noexcept;
                  ^
p1668.cpp:22:22: error: use of undeclared identifier 'thread'
void swap(thread& x, thread& y) noexcept;
                     ^
p1668.cpp:22:30: error: use of undeclared identifier 'y'
void swap(thread& x, thread& y) noexcept;
                             ^
p1668.cpp:22:32: error: expected ';' after top level declarator
void swap(thread& x, thread& y) noexcept;
                               ^
                               ;
p1668.cpp:26:1: error: use of undeclared identifier 'thread'
thread::id get_id() noexcept;
^
p1668.cpp:26:21: error: expected function body after function declarator
thread::id get_id() noexcept;
                    ^
p1668.cpp:28:2: error: undeclared identifier 'stop_callback' in destructor name
~stop_callback();
 ^
p1668.cpp:30:14: error: expected function body after function declarator
void yield() noexcept;
             ^
p1668.cpp:32:24: error: use of undeclared identifier 'chrono'
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
                       ^
p1668.cpp:34:22: error: use of undeclared identifier 'chrono'
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
                     ^
p1668.cpp:46:32: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using native_handle_type = implementation-defined;
                               ^
p1668.cpp:46:32: error: unknown type name 'implementation'
p1668.cpp:46:46: error: expected ';' after alias declaration
    using native_handle_type = implementation-defined;
                                             ^
                                             ;
p1668.cpp:49:13: error: expected ';' at end of declaration list
    thread() noexcept;
            ^
            ;
p1668.cpp:50:28: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                           ^
p1668.cpp:50:55: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                      ^
p1668.cpp:50:65: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                                ^
p1668.cpp:52:29: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    thread(const thread&) = delete;
                            ^
p1668.cpp:53:18: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    thread(thread&&) noexcept;
                 ^
p1668.cpp:53:21: error: expected ';' at end of declaration list
    thread(thread&&) noexcept;
                    ^
                    ;
p1668.cpp:54:40: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    thread& operator=(const thread&) = delete;
                                       ^
p1668.cpp:55:29: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    thread& operator=(thread&&) noexcept;
                            ^
p1668.cpp:55:32: error: expected ';' at end of declaration list
    thread& operator=(thread&&) noexcept;
                               ^
                               ;
p1668.cpp:57:23: error: expected ';' at end of declaration list
    void swap(thread&) noexcept;
                      ^
                      ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
8 warnings and 20 errors generated.
$ clang++ p1668.cpp -std=2b -o p1668l -I. -Wall
p1668.cpp:22:11: error: use of undeclared identifier 'thread'; did you mean 'fread'?
void swap(thread& x, thread& y) noexcept;
          ^~~~~~
          fread
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:113:11: note: 'fread' declared here
  using ::fread;
          ^
p1668.cpp:22:6: error: variable has incomplete type 'void'
void swap(thread& x, thread& y) noexcept;
     ^
p1668.cpp:22:19: error: use of undeclared identifier 'x'
void swap(thread& x, thread& y) noexcept;
                  ^
p1668.cpp:22:22: error: use of undeclared identifier 'thread'
void swap(thread& x, thread& y) noexcept;
                     ^
p1668.cpp:22:30: error: use of undeclared identifier 'y'
void swap(thread& x, thread& y) noexcept;
                             ^
p1668.cpp:22:32: error: expected ';' after top level declarator
void swap(thread& x, thread& y) noexcept;
                               ^
                               ;
p1668.cpp:26:1: error: use of undeclared identifier 'thread'
thread::id get_id() noexcept;
^
p1668.cpp:28:2: error: undeclared identifier 'stop_callback' in destructor name
~stop_callback();
 ^
p1668.cpp:32:24: error: use of undeclared identifier 'chrono'
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
                       ^
p1668.cpp:34:22: error: use of undeclared identifier 'chrono'
void sleep_for(const chrono::duration<Rep, Period>& rel_time);
                     ^
p1668.cpp:46:32: error: unknown type name 'implementation'
    using native_handle_type = implementation-defined;
                               ^
p1668.cpp:46:46: error: expected ';' after alias declaration
    using native_handle_type = implementation-defined;
                                             ^
                                             ;
p1668.cpp:62:5: error: unknown type name 'native_handle_type'
    native_handle_type native_handle();
    ^
p1668.cpp:86:1: error: C++ requires a type specifier for all declarations
id() noexcept;
^
p1668.cpp:101:8: error: expected unqualified-id
thread() noexcept;
       ^
p1668.cpp:104:51: error: expected ')'
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                  ^
p1668.cpp:104:49: note: to match this '('
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                                ^
p1668.cpp:104:34: error: 'explicit' can only appear on non-static member functions
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
                                 ^
p1668.cpp:113:1: error: destructor must be a non-static member function
~thread();
^
p1668.cpp:118:14: error: expected ')'
thread(thread&& x) noexcept;
             ^
p1668.cpp:118:7: note: to match this '('
thread(thread&& x) noexcept;
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1668.cpp -std=03 -o p1668g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1668.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 \
      |  ^~~~~
p1668.cpp:22:33: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   22 | void swap(thread& x, thread& y) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:22:6: error: variable or field 'swap' declared void
   22 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:22:11: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:22:11: note: 'std::thread' is only available from C++11 onwards
p1668.cpp:22:19: error: 'x' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:22:22: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:22:22: note: 'std::thread' is only available from C++11 onwards
p1668.cpp:22:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   22 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:26:1: error: 'thread' does not name a type; did you mean 'pthread_t'?
   26 | thread::id get_id() noexcept;
      | ^~~~~~
      | pthread_t
p1668.cpp:28:15: error: expected class-name before '(' token
   28 | ~stop_callback();
      |               ^
p1668.cpp:30:14: error: expected initializer before 'noexcept'
   30 | void yield() noexcept;
      |              ^~~~~~~~
p1668.cpp:32:24: error: 'chrono' does not name a type
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:32:42: error: expected unqualified-id before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:32:42: error: expected ')' before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:32:42: error: expected initializer before '<' token
p1668.cpp:34:22: error: 'chrono' does not name a type
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:34:38: error: expected unqualified-id before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:34:38: error: expected ')' before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:34:38: error: expected initializer before '<' token
p1668.cpp:46:11: error: expected nested-name-specifier before 'native_handle_type'
   46 |     using native_handle_type = implementation-defined;
      |           ^~~~~~~~~~~~~~~~~~
p1668.cpp:49:12: error: expected ';' at end of member declaration
   49 |     thread() noexcept;
      |            ^
      |             ;
p1668.cpp:49:14: error: 'noexcept' does not name a type
   49 |     thread() noexcept;
      |              ^~~~~~~~
p1668.cpp:49:14: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:50:28: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   50 |     template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                            ^~~
p1668.cpp:50:55: error: expected ',' or '...' before '&&' token
   50 |     template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                                       ^~
p1668.cpp:52:29: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   52 |     thread(const thread&) = delete;
      |                             ^~~~~~
p1668.cpp:53:18: error: expected ',' or '...' before '&&' token
   53 |     thread(thread&&) noexcept;
      |                  ^~
p1668.cpp:53:5: error: invalid constructor; you probably meant 'std::thread (const std::thread&)'
   53 |     thread(thread&&) noexcept;
      |     ^~~~~~
p1668.cpp:53:20: error: expected ';' at end of member declaration
   53 |     thread(thread&&) noexcept;
      |                    ^
      |                     ;
p1668.cpp:53:22: error: 'noexcept' does not name a type
   53 |     thread(thread&&) noexcept;
      |                      ^~~~~~~~
p1668.cpp:53:22: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:54:40: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   54 |     thread& operator=(const thread&) = delete;
      |                                        ^~~~~~
p1668.cpp:55:29: error: expected ',' or '...' before '&&' token
   55 |     thread& operator=(thread&&) noexcept;
      |                             ^~
p1668.cpp:55:31: error: expected ';' at end of member declaration
   55 |     thread& operator=(thread&&) noexcept;
      |                               ^
      |                                ;
p1668.cpp:55:33: error: 'noexcept' does not name a type
   55 |     thread& operator=(thread&&) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:55:33: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:57:22: error: expected ';' at end of member declaration
   57 |     void swap(thread&) noexcept;
      |                      ^
      |                       ;
p1668.cpp:57:24: error: 'noexcept' does not name a type
   57 |     void swap(thread&) noexcept;
      |                        ^~~~~~~~
p1668.cpp:57:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:58:21: error: expected ';' at end of member declaration
   58 |     bool joinable() const noexcept;
      |                     ^~~~~
      |                          ;
p1668.cpp:58:27: error: 'noexcept' does not name a type
   58 |     bool joinable() const noexcept;
      |                           ^~~~~~~~
p1668.cpp:58:27: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:61:17: error: expected ';' at end of member declaration
   61 |     id get_id() const noexcept;
      |                 ^~~~~
      |                      ;
p1668.cpp:61:23: error: 'noexcept' does not name a type
   61 |     id get_id() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:61:23: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:62:5: error: 'native_handle_type' does not name a type
   62 |     native_handle_type native_handle();
      |     ^~~~~~~~~~~~~~~~~~
p1668.cpp:64:46: error: expected ';' at end of member declaration
   64 |     static unsigned int hardware_concurrency() noexcept;
      |                                              ^
      |                                               ;
p1668.cpp:64:48: error: 'noexcept' does not name a type
   64 |     static unsigned int hardware_concurrency() noexcept;
      |                                                ^~~~~~~~
p1668.cpp:64:48: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:72:8: error: expected ';' at end of member declaration
   72 |     id() noexcept;
      |        ^
      |         ;
p1668.cpp:72:10: error: 'noexcept' does not name a type
   72 |     id() noexcept;
      |          ^~~~~~~~
p1668.cpp:72:10: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:74:45: error: expected initializer before 'noexcept'
   74 | bool operator==(thread::id x, thread::id y) noexcept;
      |                                             ^~~~~~~~
p1668.cpp:75:1: error: 'strong_ordering' does not name a type
   75 | strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
      | ^~~~~~~~~~~~~~~
p1668.cpp:86:6: error: expected constructor, destructor, or type conversion before 'noexcept'
   86 | id() noexcept;
      |      ^~~~~~~~
p1668.cpp:88:45: error: expected initializer before 'noexcept'
   88 | bool operator==(thread::id x, thread::id y) noexcept;
      |                                             ^~~~~~~~
p1668.cpp:90:1: error: 'strong_ordering' does not name a type
   90 | strong_ordering operator<=>(thread::id x, thread::id y) noexcept;
      | ^~~~~~~~~~~~~~~
p1668.cpp:98:19: error: explicit specialization of 'template<class T> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive]
   98 | template<> struct hash<thread::id>;
      |                   ^~~~~~~~~~~~~~~~
p1668.cpp:101:8: error: expected unqualified-id before ')' token
  101 | thread() noexcept;
      |        ^
p1668.cpp:104:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                        ^~~
p1668.cpp:104:51: error: expected ')' before '&&' token
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                                 ~ ^~
      |                                                   )
p1668.cpp:113:10: error: expected constructor, destructor, or type conversion before ';' token
  113 | ~thread();
      |          ^
p1668.cpp:118:14: error: expected ')' before '&&' token
  118 | thread(thread&& x) noexcept;
      |       ~      ^~
      |              )
p1668.cpp:122:25: error: expected ',' or '...' before '&&' token
  122 | thread& operator=(thread&& x) noexcept;
      |                         ^~
p1668.cpp:122:31: error: expected initializer before 'noexcept'
  122 | thread& operator=(thread&& x) noexcept;
      |                               ^~~~~~~~
p1668.cpp:127:22: error: expected initializer before 'noexcept'
  127 | void swap(thread& x) noexcept;
      |                      ^~~~~~~~
p1668.cpp:129:23: error: expected initializer before 'noexcept'
  129 | bool joinable() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:146:1: error: 'id' does not name a type; did you mean 'void'?
  146 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:149:33: error: expected initializer before 'noexcept'
  149 | unsigned hardware_concurrency() noexcept;
      |                                 ^~~~~~~~
p1668.cpp:154:33: error: expected initializer before 'noexcept'
  154 | void swap(thread& x, thread& y) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:163:11: error: expected nested-name-specifier before 'id'
  163 |     using id = thread::id;
      |           ^~
p1668.cpp:164:11: error: expected nested-name-specifier before 'native_handle_type'
  164 |     using native_handle_type = thread::native_handle_type;
      |           ^~~~~~~~~~~~~~~~~~
p1668.cpp:166:13: error: expected ';' at end of member declaration
  166 |     jthread() noexcept;
      |             ^
      |              ;
p1668.cpp:166:15: error: 'noexcept' does not name a type
  166 |     jthread() noexcept;
      |               ^~~~~~~~
p1668.cpp:166:15: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:167:28: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  167 |     template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                            ^~~
p1668.cpp:167:56: error: expected ',' or '...' before '&&' token
  167 |     template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                                        ^~
p1668.cpp:169:31: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  169 |     jthread(const jthread&) = delete;
      |                               ^~~~~~
p1668.cpp:170:20: error: expected ',' or '...' before '&&' token
  170 |     jthread(jthread&&) noexcept;
      |                    ^~
p1668.cpp:170:5: error: invalid constructor; you probably meant 'std::jthread (const std::jthread&)'
  170 |     jthread(jthread&&) noexcept;
      |     ^~~~~~~
p1668.cpp:170:22: error: expected ';' at end of member declaration
  170 |     jthread(jthread&&) noexcept;
      |                      ^
      |                       ;
p1668.cpp:170:24: error: 'noexcept' does not name a type
  170 |     jthread(jthread&&) noexcept;
      |                        ^~~~~~~~
p1668.cpp:170:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:171:42: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  171 |     jthread& operator=(const jthread&) = delete;
      |                                          ^~~~~~
p1668.cpp:172:31: error: expected ',' or '...' before '&&' token
  172 |     jthread& operator=(jthread&&) noexcept;
      |                               ^~
p1668.cpp:172:33: error: expected ';' at end of member declaration
  172 |     jthread& operator=(jthread&&) noexcept;
      |                                 ^
      |                                  ;
p1668.cpp:172:35: error: 'noexcept' does not name a type
  172 |     jthread& operator=(jthread&&) noexcept;
      |                                   ^~~~~~~~
p1668.cpp:172:35: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:174:23: error: expected ';' at end of member declaration
  174 |     void swap(jthread&) noexcept;
      |                       ^
      |                        ;
p1668.cpp:174:25: error: 'noexcept' does not name a type
  174 |     void swap(jthread&) noexcept;
      |                         ^~~~~~~~
p1668.cpp:174:25: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:175:5: error: expected unqualified-id before '[' token
  175 |     [[nodiscard]] bool joinable() const noexcept;
      |     ^
p1668.cpp:178:5: error: expected unqualified-id before '[' token
  178 |     [[nodiscard]] id get_id() const noexcept;
      |     ^
p1668.cpp:179:5: error: expected unqualified-id before '[' token
  179 |     [[nodiscard]] native_handle_type native_handle();
      |     ^
p1668.cpp:187:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
  187 |     auto(std::forward<Args>(args))...)
      |     ^~~~
      |     ----
p1668.cpp:187:22: error: expected ')' before '<' token
  187 |     auto(std::forward<Args>(args))...)
      |         ~            ^
      |                      )
p1668.cpp:200:9: error: expected unqualified-id before '[' token
  200 |         [[nodiscard]] stop_token get_stop_token() const noexcept;
      |         ^
p1668.cpp:201:27: error: expected ';' at end of member declaration
  201 |         bool request_stop() noexcept;
      |                           ^
      |                            ;
p1668.cpp:201:29: error: 'noexcept' does not name a type
  201 |         bool request_stop() noexcept;
      |                             ^~~~~~~~
p1668.cpp:201:29: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:203:52: error: expected ';' at end of member declaration
  203 |         friend void swap(jthread& lhs, jthread& rhs) noexcept;
      |                                                    ^
      |                                                     ;
p1668.cpp:203:54: error: 'noexcept' does not name a type
  203 |         friend void swap(jthread& lhs, jthread& rhs) noexcept;
      |                                                      ^~~~~~~~
p1668.cpp:203:54: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1668.cpp:205:9: error: expected unqualified-id before '[' token
  205 |         [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      |         ^
p1668.cpp:207:13: error: 'stop_source' does not name a type
  207 |             stop_source ssource; // exposition only
      |             ^~~~~~~~~~~
p1668.cpp:211:9: error: expected unqualified-id before ')' token
  211 | jthread() noexcept;
      |         ^
p1668.cpp:212:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                        ^~~
p1668.cpp:212:52: error: expected ')' before '&&' token
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                                  ~ ^~
      |                                                    )
p1668.cpp:213:16: error: expected ')' before '&&' token
  213 | jthread(jthread&& x) noexcept;
      |        ~       ^~
      |                )
p1668.cpp:215:11: error: expected constructor, destructor, or type conversion before ';' token
  215 | ~jthread();
      |           ^
p1668.cpp:218:27: error: expected ',' or '...' before '&&' token
  218 | jthread& operator=(jthread&& x) noexcept;
      |                           ^~
p1668.cpp:218:33: error: expected initializer before 'noexcept'
  218 | jthread& operator=(jthread&& x) noexcept;
      |                                 ^~~~~~~~
p1668.cpp:223:23: error: expected initializer before 'noexcept'
  223 | void swap(jthread& x) noexcept;
      |                       ^~~~~~~~
p1668.cpp:225:1: error: expected unqualified-id before '[' token
  225 | [[nodiscard]] bool joinable() const noexcept;
      | ^
p1668.cpp:242:1: error: 'id' does not name a type; did you mean 'void'?
  242 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:245:1: error: expected unqualified-id before '[' token
  245 | [[nodiscard]] stop_source get_stop_source() noexcept;
      | ^
p1668.cpp:247:1: error: expected unqualified-id before '[' token
  247 | [[nodiscard]] stop_token get_stop_token() const noexcept;
      | ^
p1668.cpp:249:1: error: expected unqualified-id before 'return'
  249 | return ssource.get_token();
      | ^~~~~~
p1668.cpp:250:21: error: expected initializer before 'noexcept'
  250 | bool request_stop() noexcept;
      |                     ^~~~~~~~
p1668.cpp:253:1: error: expected unqualified-id before 'return'
  253 | return ssource.request_stop();
      | ^~~~~~
p1668.cpp:255:1: error: 'friend' used outside of class
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      | ^~~~~~
      | ------
p1668.cpp:255:42: error: expected initializer before 'noexcept'
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                                          ^~~~~~~~
p1668.cpp:261:1: error: expected unqualified-id before '[' token
  261 | [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      | ^
p1668.cpp:264:21: error: expected initializer before 'noexcept'
  264 | thread::id get_id() noexcept;
      |                     ^~~~~~~~
p1668.cpp:265:14: error: expected initializer before 'noexcept'
  265 | void yield() noexcept;
      |              ^~~~~~~~
p1668.cpp:267:24: error: 'chrono' does not name a type
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:267:42: error: expected unqualified-id before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:267:42: error: expected ')' before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:267:42: error: expected initializer before '<' token
p1668.cpp:269:22: error: 'chrono' does not name a type
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:269:38: error: expected unqualified-id before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:269:38: error: expected ')' before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:269:38: error: expected initializer before '<' token
p1668.cpp:271:34: error: expected initializer before 'noexcept'
  271 | thread::id this_thread::get_id() noexcept;
      |                                  ^~~~~~~~
p1668.cpp:272:27: error: expected initializer before 'noexcept'
  272 | void this_thread::yield() noexcept;
      |                           ^~~~~~~~
p1668.cpp:275:24: error: 'chrono' does not name a type
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:275:42: error: expected unqualified-id before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:275:42: error: expected ')' before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:275:42: error: expected initializer before '<' token
p1668.cpp:279:22: error: 'chrono' does not name a type
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:279:38: error: expected unqualified-id before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:279:38: error: expected ')' before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:279:38: error: expected initializer before '<' token

$ g++ p1668.cpp -std=2b -o p1668g -I. -Wall
p1668.cpp:22:6: error: variable or field 'swap' declared void
   22 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:22:11: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:11:1: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
   10 | #include "N4910.h"
  +++ |+#include <thread>
   11 | 
p1668.cpp:22:19: error: 'x' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:22:22: error: 'thread' was not declared in this scope
   22 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:22:22: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
p1668.cpp:22:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   22 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:26:1: error: 'thread' does not name a type; did you mean 'pthread_t'?
   26 | thread::id get_id() noexcept;
      | ^~~~~~
      | pthread_t
p1668.cpp:28:15: error: expected class-name before '(' token
   28 | ~stop_callback();
      |               ^
p1668.cpp:32:24: error: 'chrono' does not name a type
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:32:42: error: expected unqualified-id before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:32:42: error: expected ')' before '<' token
   32 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:32:42: error: expected initializer before '<' token
p1668.cpp:34:22: error: 'chrono' does not name a type
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:34:38: error: expected unqualified-id before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:34:38: error: expected ')' before '<' token
   34 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:34:38: error: expected initializer before '<' token
p1668.cpp:46:32: error: 'implementation' does not name a type
   46 |     using native_handle_type = implementation-defined;
      |                                ^~~~~~~~~~~~~~
p1668.cpp:62:5: error: 'native_handle_type' does not name a type
   62 |     native_handle_type native_handle();
      |     ^~~~~~~~~~~~~~~~~~
p1668.cpp:86:14: error: expected constructor, destructor, or type conversion before ';' token
   86 | id() noexcept;
      |              ^
p1668.cpp:98:19: error: explicit specialization of 'template<class _Tp> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive]
   98 | template<> struct hash<thread::id>;
      |                   ^~~~~~~~~~~~~~~~
p1668.cpp:101:18: error: expected constructor, destructor, or type conversion before ';' token
  101 | thread() noexcept;
      |                  ^
p1668.cpp:104:43: error: ISO C++ forbids declaration of 'thread' with no type [-fpermissive]
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:104:34: error: 'explicit' outside class declaration
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                  ^~~~~~~~
p1668.cpp:113:10: error: expected constructor, destructor, or type conversion before ';' token
  113 | ~thread();
      |          ^
p1668.cpp:118:7: error: expected constructor, destructor, or type conversion before '(' token
  118 | thread(thread&& x) noexcept;
      |       ^
p1668.cpp:122:1: error: reference to 'thread' is ambiguous
  122 | thread& operator=(thread&& x) noexcept;
      | ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:127:6: error: variable or field 'swap' declared void
  127 | void swap(thread& x) noexcept;
      |      ^~~~
p1668.cpp:127:11: error: reference to 'thread' is ambiguous
  127 | void swap(thread& x) noexcept;
      |           ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:127:19: error: 'x' was not declared in this scope
  127 | void swap(thread& x) noexcept;
      |                   ^
p1668.cpp:129:23: error: non-member function 'bool joinable()' cannot have cv-qualifier
  129 | bool joinable() const noexcept;
      |                       ^~~~~~~~
p1668.cpp:146:1: error: 'id' does not name a type; did you mean 'void'?
  146 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:154:6: error: variable or field 'swap' declared void
  154 | void swap(thread& x, thread& y) noexcept;
      |      ^~~~
p1668.cpp:154:11: error: reference to 'thread' is ambiguous
  154 | void swap(thread& x, thread& y) noexcept;
      |           ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:154:19: error: 'x' was not declared in this scope
  154 | void swap(thread& x, thread& y) noexcept;
      |                   ^
p1668.cpp:154:22: error: reference to 'thread' is ambiguous
  154 | void swap(thread& x, thread& y) noexcept;
      |                      ^~~~~~
p1668.cpp:42:7: note: candidates are: 'class std::thread'
   42 | class thread {
      |       ^~~~~~
p1668.cpp:104:43: note:                 'template<class F, class ... Args> int thread(F&&, Args&& ...)'
  104 | template<class F, class... Args> explicit thread(F&& f, Args&&... args);
      |                                           ^~~~~~
p1668.cpp:154:30: error: 'y' was not declared in this scope; did you mean 'yn'?
  154 | void swap(thread& x, thread& y) noexcept;
      |                              ^
      |                              yn
p1668.cpp:164:40: error: 'native_handle_type' in 'class std::thread' does not name a type
  164 |     using native_handle_type = thread::native_handle_type;
      |                                        ^~~~~~~~~~~~~~~~~~
p1668.cpp:179:19: error: 'native_handle_type' does not name a type
  179 |     [[nodiscard]] native_handle_type native_handle();
      |                   ^~~~~~~~~~~~~~~~~~
p1668.cpp:187:23: error: 'Args' was not declared in this scope
  187 |     auto(std::forward<Args>(args))...)
      |                       ^~~~
p1668.cpp:187:29: error: 'args' has not been declared
  187 |     auto(std::forward<Args>(args))...)
      |                             ^~~~
p1668.cpp:187:10: error: invalid use of '::'
  187 |     auto(std::forward<Args>(args))...)
      |          ^~~
p1668.cpp:187:34: error: expected ';' at end of member declaration
  187 |     auto(std::forward<Args>(args))...)
      |                                  ^
      |                                   ;
p1668.cpp:187:35: error: expected unqualified-id before '...' token
  187 |     auto(std::forward<Args>(args))...)
      |                                   ^~~
p1668.cpp:200:23: error: 'stop_token' does not name a type
  200 |         [[nodiscard]] stop_token get_stop_token() const noexcept;
      |                       ^~~~~~~~~~
p1668.cpp:207:13: error: 'stop_source' does not name a type
  207 |             stop_source ssource; // exposition only
      |             ^~~~~~~~~~~
p1668.cpp:211:19: error: expected constructor, destructor, or type conversion before ';' token
  211 | jthread() noexcept;
      |                   ^
p1668.cpp:212:43: error: ISO C++ forbids declaration of 'jthread' with no type [-fpermissive]
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:212:34: error: 'explicit' outside class declaration
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                  ^~~~~~~~
p1668.cpp:213:8: error: expected constructor, destructor, or type conversion before '(' token
  213 | jthread(jthread&& x) noexcept;
      |        ^
p1668.cpp:215:11: error: expected constructor, destructor, or type conversion before ';' token
  215 | ~jthread();
      |           ^
p1668.cpp:218:1: error: reference to 'jthread' is ambiguous
  218 | jthread& operator=(jthread&& x) noexcept;
      | ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:223:6: error: variable or field 'swap' declared void
  223 | void swap(jthread& x) noexcept;
      |      ^~~~
p1668.cpp:223:11: error: reference to 'jthread' is ambiguous
  223 | void swap(jthread& x) noexcept;
      |           ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:223:20: error: 'x' was not declared in this scope
  223 | void swap(jthread& x) noexcept;
      |                    ^
p1668.cpp:225:37: error: non-member function 'bool joinable()' cannot have cv-qualifier
  225 | [[nodiscard]] bool joinable() const noexcept;
      |                                     ^~~~~~~~
p1668.cpp:242:1: error: 'id' does not name a type; did you mean 'void'?
  242 | id get_id() const noexcept;
      | ^~
      | void
p1668.cpp:245:15: error: 'stop_source' does not name a type
  245 | [[nodiscard]] stop_source get_stop_source() noexcept;
      |               ^~~~~~~~~~~
p1668.cpp:247:15: error: 'stop_token' does not name a type
  247 | [[nodiscard]] stop_token get_stop_token() const noexcept;
      |               ^~~~~~~~~~
p1668.cpp:249:1: error: expected unqualified-id before 'return'
  249 | return ssource.get_token();
      | ^~~~~~
p1668.cpp:253:1: error: expected unqualified-id before 'return'
  253 | return ssource.request_stop();
      | ^~~~~~
p1668.cpp:255:1: error: 'friend' used outside of class
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      | ^~~~~~
      | ------
p1668.cpp:255:13: error: variable or field 'swap' declared void
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |             ^~~~
p1668.cpp:255:18: error: reference to 'jthread' is ambiguous
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                  ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:255:27: error: 'x' was not declared in this scope
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                           ^
p1668.cpp:255:30: error: reference to 'jthread' is ambiguous
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                              ^~~~~~~
p1668.cpp:160:7: note: candidates are: 'class std::jthread'
  160 | class jthread {
      |       ^~~~~~~
p1668.cpp:212:43: note:                 'template<class F, class ... Args> int jthread(F&&, Args&& ...)'
  212 | template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
      |                                           ^~~~~~~
p1668.cpp:255:39: error: 'y' was not declared in this scope; did you mean 'yn'?
  255 | friend void swap(jthread& x, jthread& y) noexcept;
      |                                       ^
      |                                       yn
p1668.cpp:261:35: error: 'unsigned int hardware_concurrency()' was declared 'extern' and later 'static' [-fpermissive]
  261 | [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
      |                                   ^~~~~~~~~~~~~~~~~~~~
p1668.cpp:149:10: note: previous declaration of 'unsigned int hardware_concurrency()'
  149 | unsigned hardware_concurrency() noexcept;
      |          ^~~~~~~~~~~~~~~~~~~~
p1668.cpp:267:24: error: 'chrono' does not name a type
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:267:42: error: expected unqualified-id before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:267:42: error: expected ')' before '<' token
  267 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:267:42: error: expected initializer before '<' token
p1668.cpp:269:22: error: 'chrono' does not name a type
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:269:38: error: expected unqualified-id before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:269:38: error: expected ')' before '<' token
  269 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:269:38: error: expected initializer before '<' token
p1668.cpp:275:24: error: 'chrono' does not name a type
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                        ^~~~~~
p1668.cpp:275:42: error: expected unqualified-id before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                                          ^
p1668.cpp:275:42: error: expected ')' before '<' token
  275 | void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
      |                 ~                        ^
      |                                          )
p1668.cpp:275:42: error: expected initializer before '<' token
p1668.cpp:279:22: error: 'chrono' does not name a type
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                      ^~~~~~
p1668.cpp:279:38: error: expected unqualified-id before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |                                      ^
p1668.cpp:279:38: error: expected ')' before '<' token
  279 | void sleep_for(const chrono::duration<Rep, Period>& rel_time);
      |               ~                      ^
      |                                      )
p1668.cpp:279:38: error: expected initializer before '<' token

検討事項(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 初稿  20220922

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