はじめに(Introduction)
N4910 Working Draft, Standard for Programming Language C++
n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。
<この項は書きかけです。順次追記します。>
背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。
この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。
https://stackoverflow.com
https://cpprefjp.github.io
http://ja.cppreference.com/
また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。
作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
C++N3242, 2011 sample code compile list on clang++ and g++
編纂器(Compiler)
clang++ --version
Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin
g++- --version
g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20.2.2 Header synopsis [memory.syn] C++N4910:2022 (420) p578.cpp
算譜(source code)
// 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 = "20.2.2 Header <memory> synopsis [memory.syn] C++N4910:2022 (420) p578.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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>
#include <atomic>
#include <unordered_map>
#include <typeinfo>
#include <memory>
using namespace std;
// Example 1
#include <compare> // see 17.11.1
namespace std {
// 20.2.3, pointer traits
template<class Ptr> struct pointer_traits;
template<class T> struct pointer_traits<T*>;
// 20.2.4, pointer conversion
template<class T>
constexpr T* to_address(T* p) noexcept;
template<class Ptr>
constexpr auto to_address(const Ptr& p) noexcept;
// 20.2.5, pointer alignment
void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
template<size_t N, class T>
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
// This Clause describes components for memory management.
// The following subclauses describe general memory management facilities, smart pointers, memory resources,and scoped allocators, as summarized in Table 42.
// 20.2.6, allocator argument tag
struct allocator_arg_t {
explicit allocator_arg_t() = default;
};
inline constexpr allocator_arg_t allocator_arg{};
// 20.2.7, uses_allocator
template<class T, class Alloc> struct uses_allocator;
// 20.2.7.1, uses_allocator
template<class T, class Alloc>
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
// 20.2.7.2, uses-allocator construction
template<class T, class Alloc, class... Args>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
Args&&... args) noexcept;
template<class T, class Alloc, class Tuple1, class Tuple2>
constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
Tuple1&& x, Tuple2&& y) noexcept;
template<class T, class Alloc>
constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
U&& u, V&& v) noexcept;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
pair<U, V>& pr) noexcept;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
const pair<U, V>& pr) noexcept;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
pair<U, V>&& pr) noexcept;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
const pair<U, V>&& pr) noexcept;
template<class T, class Alloc, class U>
constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u) noexcept;
template<class T, class Alloc, class... Args>
constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
template<class T, class Alloc, class... Args>
constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
Args&&... args);
// 20.2.8, allocator traits
template<class Alloc> struct allocator_traits;
template<class Pointer>
struct allocation_result {
Pointer ptr;
size_t count;
};
template<class Allocator>
[[nodiscard] constexpr allocation_result<typename allocator_traits<Allocator>::pointer>
allocate_at_least(Allocator& a, size_t n);
// 20.2.9, the default allocator
template<class T> class allocator;
template<class T, class U>
constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
// 20.2.10, addressof
template<class T>
constexpr T* addressof(T& r) noexcept;
template<class T>
const T* addressof(const T&&) = delete;
// 27.11, specialized algorithms
// 27.11.2, special memory concepts
template<class I>
concept nothrow-input-iterator = see below ; template<class I>
// exposition only // exposition only // exposition only // exposition only // exposition only
concept nothrow-forward-iterator = see_below;
template<class S, class I>
concept nothrow-sentinel-for = see_below;
template<class R>
concept nothrow-input-range = see_below;
template<class R>
concept nothrow-forward-range = see_below ;
template<class NoThrowForwardIterator>
void uninitialized_default_construct(NoThrowForwardIterator first,
NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void uninitialized_default_construct(ExecutionPolicy&& exec,
NoThrowForwardIterator first,
NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
NoThrowForwardIterator
// see 27.3.5
uninitialized_default_construct_n(NoThrowForwardIterator first, Size n);
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
NoThrowForwardIterator
uninitialized_default_construct_n(ExecutionPolicy&& exec, // see 27.3.5
NoThrowForwardIterator first, Size n);
namespace ranges {
template<nothrow-forward-iterator I, nothrow-sentinel-for <I> S>
requires default_initializable<iter_value_t<I>>
I uninitialized_default_construct(I first, S last);
template<nothrow-forward-range R>
requires default_initializable<range_value_t<R>>
borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
template<nothrow-forward-iterator I>
requires default_initializable<iter_value_t<I>>
I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
}
template<class NoThrowForwardIterator>
void uninitialized_value_construct(NoThrowForwardIterator first,
NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void uninitialized_value_construct(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
NoThrowForwardIterator
uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
NoThrowForwardIterator uninitialized_value_construct_n(ExecutionPolicy&& exec, // see 27.3.5
NoThrowForwardIterator first, Size n);
namespace ranges {
template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
requires default_initializable<iter_value_t<I>>
I uninitialized_value_construct(I first, S last);
template<nothrow-forward-range R>
requires default_initializable<range_value_t<R>>
borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
template<nothrow-forward-iterator I>
requires default_initializable<iter_value_t<I>>
I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
}
template<class InputIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, ForwardIterator last,
NoThrowForwardIterator result);
template<class InputIterator, class Size, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class Size,
class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, Size n,
NoThrowForwardIterator result);
namespace ranges {
template<class I, class O>
using uninitialized_copy_result = in_out_result<I, O>;
template<input_iterator I, sentinel_for<I> S1,
nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
uninitialized_copy_result<I, O>
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
template<input_range IR, nothrow-forward-range OR>
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_copy(IR&& in_range, OR&& out_range);
template<class I, class O>
using uninitialized_copy_n_result = in_out_result<I, O>;
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
uninitialized_copy_n_result<I, O>
uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
}
template<class InputIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last,
NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, ForwardIterator last,
NoThrowForwardIterator result);
template<class InputIterator, class Size, class NoThrowForwardIterator>
pair<InputIterator, NoThrowForwardIterator>
uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
template<class ExecutionPolicy, class ForwardIterator, class Size,
class NoThrowForwardIterator>
pair<ForwardIterator, NoThrowForwardIterator> uninitialized_move_n(ExecutionPolicy&& exec, // see 27.3.5
ForwardIterator first, Size n, NoThrowForwardIterator result);
namespace ranges {
template<class I, class O>
using uninitialized_move_result = in_out_result<I, O>;
template<input_iterator I, sentinel_for<I> S1,
nothrow-forward-iterator O, nothrow-sentinel-for <O> S2>
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
uninitialized_move_result<I, O>
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
template<input_range IR, nothrow-forward-range OR>
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_move(IR&& in_range, OR&& out_range);
template<class I, class O>
using uninitialized_move_n_result = in_out_result<I, O>;
template<input_iterator I,
nothrow-forward-iterator O, nothrow-sentinel-for <O> S>
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
uninitialized_move_n_result<I, O>
uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
}
template<class NoThrowForwardIterator, class T>
void uninitialized_fill(NoThrowForwardIterator first, NoThrowForwardIterator last,
const T& x);
template<class ExecutionPolicy, class NoThrowForwardIterator, class T>
void uninitialized_fill(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last,
const T& x);
template<class NoThrowForwardIterator, class Size, class T>
NoThrowForwardIterator
uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x);
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size, class T>
NoThrowForwardIterator
uninitialized_fill_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n,
const T& x);
namespace ranges {
template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
S, class T>
requires constructible_from<iter_value_t<I>, const T&>
I uninitialized_fill(I first, S last, const T& x);
template<nothrow-forward-range R, class T>
requires constructible_from<range_value_t<R>, const T&>
borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
template<nothrow-forward-iterator I, class T>
requires constructible_from<iter_value_t<I>, const T&>
I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
}
// 27.11.8, construct_at
template<class T, class... Args>
constexpr T* construct_at(T* location, Args&&... args);
namespace ranges {
template<class T, class... Args>
constexpr T* construct_at(T* location, Args&&... args);
}
// 27.11.9, destroy
template<class T>
constexpr void destroy_at(T* location);
template<class NoThrowForwardIterator>
constexpr void destroy(NoThrowForwardIterator first, NoThrowForwardIterator last);
template<class ExecutionPolicy, class NoThrowForwardIterator>
void destroy(ExecutionPolicy&& exec, // see 27.3.5
NoThrowForwardIterator first, NoThrowForwardIterator last);
template<class NoThrowForwardIterator, class Size>
constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n);
namespace ranges {
template<destructible T>
constexpr void destroy_at(T* location) noexcept;
template<nothrow-input-iterator I, nothrow-sentinel-for <I> S> requires destructible<iter_value_t<I>>
constexpr I destroy(I first, S last) noexcept; template<nothrow-input-range R>
requires destructible<range_value_t<R>>
constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept;
template<nothrow-input-iterator I> requires destructible<iter_value_t<I>>
constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept;
}
// 20.3.1, class
template unique_ptr
template<class T> struct default_delete;
template<class T> struct default_delete<T[]>;
template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
template<class T, class... Args>
constexpr unique_ptr<T> make_unique(Args&&... args);
template<class T>
constexpr unique_ptr<T> make_unique(size_t n);
template<class T, class... Args>
unspecified make_unique(Args&&...) = delete;
template<class T>
constexpr unique_ptr<T> make_unique_for_overwrite();
template<class T>
constexpr unique_ptr<T> make_unique_for_overwrite(size_t n);
template<class T, class... Args>
unspecified make_unique_for_overwrite(Args&&...) = delete;
template<class T, class D>
constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
template<class T1, class D1, class T2, class D2>
constexpr bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
template<class T1, class D1, class T2, class D2>
bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
template<class T1, class D1, class T2, class D2>
bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
template<class T1, class D1, class T2, class D2>
bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
template<class T1, class D1, class T2, class D2>
bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
template<class T1, class D1, class T2, class D2>
requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer,
typename unique_ptr<T2, D2>::pointer>
compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer,
typename unique_ptr<T2, D2>::pointer>
operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
// T is not array //TisU[] //TisU[N]
// T is not array //TisU[] //TisU[N]
template<class T, class D>
constexpr bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
template<class T, class D>
constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t);
template<class T, class D>
constexpr bool operator<(nullptr_t, const unique_ptr<T, D>& y);
template<class T, class D>
constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t);
template<class T, class D>
constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& y);
template<class T, class D>
constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
template<class T, class D>
constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
template<class T, class D>
constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
template<class T, class D>
constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
template<class T, class D>
requires three_way_comparable<typename unique_ptr<T, D>::pointer>
constexpr compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
operator<=>(const unique_ptr<T, D>& x, nullptr_t);
template<class E, class T, class Y, class D>
basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
// 20.3.2.1, class bad_weak_ptr
class bad_weak_ptr;
// 20.3.2.2, class template shared_ptr
template<class T> class shared_ptr;
// 20.3.2.2.7, shared_ptr creation
template<class T, class... Args>
shared_ptr<T> make_shared(Args&&... args);
template<class T, class A, class... Args>
shared_ptr<T> allocate_shared(const A& a, Args&&... args);
template<class T>
shared_ptr<T> make_shared(size_t N);
template<class T, class A>
shared_ptr<T> allocate_shared(const A& a, size_t N);
template<class T>
shared_ptr<T> make_shared();
template<class T, class A>
shared_ptr<T> allocate_shared(const A& a);
template<class T>
shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u);
template<class T, class A>
shared_ptr<T> allocate_shared(const A& a, size_t N,
const remove_extent_t<T>& u);
template<class T>
shared_ptr<T> make_shared(const remove_extent_t<T>& u);
template<class T, class A>
shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u);
template<class T>
shared_ptr<T> make_shared_for_overwrite();
template<class T, class A>
shared_ptr<T> allocate_shared_for_overwrite(const A& a);
// T is not array // T is not array
//TisU[] //TisU[]
//TisU[N] //TisU[N]
// T is U[]
// T is U[]
// T is U[N] // T is U[N]
// T is not U[] // T is not U[]
template<class T>
shared_ptr<T> make_shared_for_overwrite(size_t N);
template<class T, class A>
shared_ptr<T> allocate_shared_for_overwrite(const A& a, size_t N);
// 20.3.2.2.8, shared_ptr comparisons
template<class T, class U>
bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T, class U>
// T is U[] // T is U[]
strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T>
bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
strong_ordering operator<=>(const shared_ptr<T>& x, nullptr_t) noexcept;
// 20.3.2.2.9, shared_ptr specialized algorithms
template<class T>
void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
// 20.3.2.2.10, shared_ptr casts
template<class T, class U>
shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
template<class T, class U>
shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
template<class T, class U>
shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
template<class T, class U>
shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
template<class T, class U>
shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
template<class T, class U>
shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
template<class T, class U>
shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept;
template<class T, class U>
shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
// 20.3.2.2.11, shared_ptr get_deleter
template<class D, class T>
D* get_deleter(const shared_ptr<T>& p) noexcept;
// 20.3.2.2.12, shared_ptr I/O
template<class E, class T, class Y>
basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr<Y>& p);
// 20.3.2.3, class template weak_ptr
template<class T> class weak_ptr;
// 20.3.2.3.7, weak_ptr specialized algorithms
template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
// 20.3.2.4, class template owner_less
template<class T = void> struct owner_less;
// 20.3.2.5, class template enable_shared_from_this
template<class T> class enable_shared_from_this;
// 20.3.3, hash support
template<class T> struct hash;
template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;
// Type: Ptr::element_type if the qualified-id Ptr::element_type is valid and denotes a type (13.10.3); otherwise, T if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments; otherwise, the specialization is ill-formed.
// 33.5.8.7, atomic smart pointers
template<class T> struct atomic;
template<class T> struct atomic<shared_ptr<T>>; template<class T> struct atomic<weak_ptr<T>>;
// 20.3.4.1, class template out_ptr_t
template<class Smart, class Pointer, class... Args>
class out_ptr_t;
// 20.3.4.2, function template out_ptr
template<class Pointer = void, class Smart, class... Args>
auto out_ptr(Smart& s, Args&&... args);
// 20.3.4.3, class template inout_ptr_t
template<class Smart, class Pointer, class... Args>
class inout_ptr_t;
// 20.3.4.4, function template inout_ptr
template<class Pointer = void, class Smart, class... Args>
auto inout_ptr(Smart& s, Args&&... args);
}
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p578.cpp -std=c++03 -o p578l -I. -Wall
In file included from p578.cpp:19:
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 \
^
p578.cpp:34:7: error: unknown type name 'constexpr'
constexpr T* to_address(T* p) noexcept;
^
p578.cpp:34:17: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr T* to_address(T* p) noexcept;
^
p578.cpp:34:18: error: expected ';' at end of declaration
constexpr T* to_address(T* p) noexcept;
^
;
p578.cpp:34:20: error: C++ requires a type specifier for all declarations
constexpr T* to_address(T* p) noexcept;
^
p578.cpp:34:34: error: use of undeclared identifier 'p'
constexpr T* to_address(T* p) noexcept;
^
p578.cpp:34:36: error: expected ';' after top level declarator
constexpr T* to_address(T* p) noexcept;
^
;
p578.cpp:36:7: error: unknown type name 'constexpr'
constexpr auto to_address(const Ptr& p) noexcept;
^
p578.cpp:36:17: error: illegal storage class on function
constexpr auto to_address(const Ptr& p) noexcept;
^
p578.cpp:36:46: error: expected ';' at end of declaration
constexpr auto to_address(const Ptr& p) noexcept;
^
;
p578.cpp:36:47: error: C++ requires a type specifier for all declarations
constexpr auto to_address(const Ptr& p) noexcept;
^
p578.cpp:39:8: error: expected expression
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
p578.cpp:39:21: error: C++ requires a type specifier for all declarations
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
p578.cpp:39:21: warning: variable templates are a C++14 extension [-Wc++14-extensions]
p578.cpp:39:30: error: expected ';' at end of declaration
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
;
p578.cpp:39:31: error: unknown type name 'T'
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
p578.cpp:39:52: error: use of undeclared identifier 'ptr'
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
p578.cpp:43:55: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
p578.cpp:43:74: error: unknown type name 'constexpr'
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
p578.cpp:43:67: warning: inline variables are a C++17 extension [-Wc++17-extensions]
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
p578.cpp:43:99: error: expected ';' after top level declarator
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
;
p578.cpp:48:10: error: unknown type name 'constexpr'
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
^
p578.cpp:48:25: warning: variable templates are a C++14 extension [-Wc++14-extensions]
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
^
p578.cpp:48:3: warning: inline variables are a C++17 extension [-Wc++17-extensions]
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
^
p578.cpp:50:37: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<class T, class Alloc, class... Args>
^
p578.cpp:51:3: error: unknown type name 'constexpr'
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
^
p578.cpp:52:55: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
Args&&... args) noexcept;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
8 warnings and 20 errors generated.
rm: cannot remove 'p578l': No such file or directory
$ clang++ p578.cpp -std=c++2b -o p578l -I. -Wall
p578.cpp:38:7: error: 'align' is missing exception specification 'noexcept'
void* align(size_t alignment, size_t size, void*& ptr, size_t& space); template<size_t N, class T>
^
noexcept
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:123:1: note: previous declaration is here
align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept
^
p578.cpp:39:34: error: 'assume_aligned' is missing exception specification 'noexcept'
[[nodiscard]] constexpr T* assume_aligned(T* ptr);
^
noexcept
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:197:5: note: previous declaration is here
assume_aligned(_Tp* __ptr) noexcept
^
p578.cpp:43:8: error: redefinition of 'allocator_arg_t'
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/uses_allocator.h:50:10: note: previous definition is here
struct allocator_arg_t { explicit allocator_arg_t() = default; };
^
p578.cpp:43:100: error: redefinition of 'allocator_arg'
struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/uses_allocator.h:52:47: note: previous definition is here
_GLIBCXX17_INLINE constexpr allocator_arg_t allocator_arg =
^
p578.cpp:48:25: error: redefinition of 'uses_allocator_v'
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/uses_allocator.h:127:27: note: previous definition is here
inline constexpr bool uses_allocator_v =
^
p578.cpp:76:15: error: constexpr declaration of 'make_obj_using_allocator' follows non-constexpr declaration
constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:390:5: note: previous declaration is here
make_obj_using_allocator(const _Alloc& __a, _Args&&... __args)
^
p578.cpp:78:16: error: constexpr declaration of 'uninitialized_construct_using_allocator' follows non-constexpr declaration
constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:399:5: note: previous declaration is here
uninitialized_construct_using_allocator(_Tp* __p, const _Alloc& __a,
^
p578.cpp:88:15: error: expected ']'
[[nodiscard] constexpr allocation_result<typename allocator_traits<Allocator>::pointer>
^
]
p578.cpp:439:1: error: expected unqualified-id
}
^
9 errors generated.
$ g++ p578.cpp -std=c++03 -o p578g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from p578.cpp:19:
/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 \
| ^~~~~
p578.cpp:34:7: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
34 | constexpr T* to_address(T* p) noexcept;
| ^~~~~~~~~
p578.cpp:34:37: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
34 | constexpr T* to_address(T* p) noexcept;
| ^~~~~~~~
p578.cpp:34:7: error: 'constexpr' does not name a type
34 | constexpr T* to_address(T* p) noexcept;
| ^~~~~~~~~
p578.cpp:34:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:36:7: error: 'constexpr' does not name a type
36 | constexpr auto to_address(const Ptr& p) noexcept;
| ^~~~~~~~~
p578.cpp:36:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:39:7: error: expected unqualified-id before '[' token
39 | [[nodiscard]] constexpr T* assume_aligned(T* ptr);
| ^
p578.cpp:43:55: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
43 | struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
| ^~~~~~~
p578.cpp:43:74: error: 'constexpr' does not name a type
43 | struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
| ^~~~~~~~~
p578.cpp:43:74: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:48:10: error: 'constexpr' does not name a type
48 | inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
| ^~~~~~~~~
p578.cpp:48:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:50:37: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
50 | template<class T, class Alloc, class... Args>
| ^~~
p578.cpp:51:3: error: 'constexpr' does not name a type
51 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:51:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:54:3: error: 'constexpr' does not name a type
54 | constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
| ^~~~~~~~~
p578.cpp:54:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:57:3: error: 'constexpr' does not name a type
57 | constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept;
| ^~~~~~~~~
p578.cpp:57:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:59:3: error: 'constexpr' does not name a type
59 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:59:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:62:3: error: 'constexpr' does not name a type
62 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:62:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:65:3: error: 'constexpr' does not name a type
65 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:65:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:68:3: error: 'constexpr' does not name a type
68 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:68:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:71:3: error: 'constexpr' does not name a type
71 | constexpr auto uses_allocator_construction_args(const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:71:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:74:3: error: 'constexpr' does not name a type
74 | constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u) noexcept;
| ^~~~~~~~~
p578.cpp:74:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:75:37: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
75 | template<class T, class Alloc, class... Args>
| ^~~
p578.cpp:76:3: error: 'constexpr' does not name a type
76 | constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
| ^~~~~~~~~
p578.cpp:76:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:77:37: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
77 | template<class T, class Alloc, class... Args>
| ^~~
p578.cpp:78:3: error: 'constexpr' does not name a type
78 | constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
| ^~~~~~~~~
p578.cpp:78:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:88:3: error: expected unqualified-id before '[' token
88 | [[nodiscard] constexpr allocation_result<typename allocator_traits<Allocator>::pointer>
| ^
p578.cpp:93:3: error: 'constexpr' does not name a type
93 | constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
| ^~~~~~~~~
p578.cpp:93:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:96:3: error: 'constexpr' does not name a type
96 | constexpr T* addressof(T& r) noexcept;
| ^~~~~~~~~
p578.cpp:96:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:98:29: error: expected ',' or '...' before '&&' token
98 | const T* addressof(const T&&) = delete;
| ^~
p578.cpp:98:35: warning: defaulted and deleted functions only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
98 | const T* addressof(const T&&) = delete;
| ^~~~~~
p578.cpp:102:1: error: 'concept' does not name a type
102 | concept nothrow-input-iterator = see below ; template<class I>
| ^~~~~~~
p578.cpp:102:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p578.cpp:104:1: error: 'concept' does not name a type
104 | concept nothrow-forward-iterator = see_below;
| ^~~~~~~
p578.cpp:104:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p578.cpp:106:1: error: 'concept' does not name a type
106 | concept nothrow-sentinel-for = see_below;
| ^~~~~~~
p578.cpp:106:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p578.cpp:108:1: error: 'concept' does not name a type
108 | concept nothrow-input-range = see_below;
| ^~~~~~~
p578.cpp:108:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p578.cpp:110:1: error: 'concept' does not name a type
110 | concept nothrow-forward-range = see_below ;
| ^~~~~~~
p578.cpp:110:1: note: 'concept' only available with '-std=c++20' or '-fconcepts'
p578.cpp:115:55: error: expected ',' or '...' before '&&' token
115 | void uninitialized_default_construct(ExecutionPolicy&& exec,
| ^~
p578.cpp:124:50: error: expected ',' or '...' before '&&' token
124 | uninitialized_default_construct_n(ExecutionPolicy&& exec, // see 27.3.5
| ^~
p578.cpp:127:10: error: 'nothrow' is not a type
127 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I> S>
| ^~~~~~~
p578.cpp:127:17: error: expected '>' before '-' token
127 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I> S>
| ^
p578.cpp:128:5: error: 'requires' does not name a type
128 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~
p578.cpp:128:5: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:130:10: error: 'nothrow' is not a type
130 | template<nothrow-forward-range R>
| ^~~~~~~
p578.cpp:130:17: error: expected '>' before '-' token
130 | template<nothrow-forward-range R>
| ^
p578.cpp:131:1: error: 'requires' does not name a type
131 | requires default_initializable<range_value_t<R>>
| ^~~~~~~~
p578.cpp:131:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:133:10: error: 'nothrow' is not a type
133 | template<nothrow-forward-iterator I>
| ^~~~~~~
p578.cpp:133:17: error: expected '>' before '-' token
133 | template<nothrow-forward-iterator I>
| ^
p578.cpp:134:1: error: 'requires' does not name a type
134 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~
p578.cpp:134:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:141:51: error: expected ',' or '...' before '&&' token
141 | void uninitialized_value_construct(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last);
| ^~
p578.cpp:144:74: error: expected ')' before ';' token
144 | uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
| ^
| )
p578.cpp:141:35: note: to match this '('
141 | void uninitialized_value_construct(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last);
| ^
p578.cpp:146:71: error: expected ',' or '...' before '&&' token
146 | NoThrowForwardIterator uninitialized_value_construct_n(ExecutionPolicy&& exec, // see 27.3.5
| ^~
p578.cpp:149:10: error: 'nothrow' is not a type
149 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^~~~~~~
p578.cpp:149:17: error: expected '>' before '-' token
149 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^
p578.cpp:151:55: error: expected unqualified-id before ';' token
151 | I uninitialized_value_construct(I first, S last);
| ^
p578.cpp:152:10: error: 'nothrow' is not a type
152 | template<nothrow-forward-range R>
| ^~~~~~~
p578.cpp:152:17: error: expected '>' before '-' token
152 | template<nothrow-forward-range R>
| ^
p578.cpp:153:1: error: 'requires' does not name a type
153 | requires default_initializable<range_value_t<R>>
| ^~~~~~~~
p578.cpp:153:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:155:10: error: 'nothrow' is not a type
155 | template<nothrow-forward-iterator I>
| ^~~~~~~
p578.cpp:155:17: error: expected '>' before '-' token
155 | template<nothrow-forward-iterator I>
| ^
p578.cpp:156:1: error: 'requires' does not name a type
156 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~
p578.cpp:156:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:163:58: error: expected ',' or '...' before '&&' token
163 | NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, ForwardIterator last,
| ^~
p578.cpp:170:60: error: expected ',' or '...' before '&&' token
170 | NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, Size n,
| ^~
p578.cpp:174:5: error: expected unqualified-id before 'using'
174 | using uninitialized_copy_result = in_out_result<I, O>;
| ^~~~~
p578.cpp:175:12: error: 'input_iterator' has not been declared
175 | template<input_iterator I, sentinel_for<I> S1,
| ^~~~~~~~~~~~~~
p578.cpp:175:30: error: 'sentinel_for' has not been declared
175 | template<input_iterator I, sentinel_for<I> S1,
| ^~~~~~~~~~~~
p578.cpp:175:42: error: expected '>' before '<' token
175 | template<input_iterator I, sentinel_for<I> S1,
| ^
p578.cpp:176:58: error: 'requires' does not name a type
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~~
p578.cpp:176:58: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:179:10: error: 'input_range' has not been declared
179 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~~~~~
p578.cpp:179:26: error: 'nothrow' is not a type
179 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~
p578.cpp:179:33: error: expected '>' before '-' token
179 | template<input_range IR, nothrow-forward-range OR>
| ^
p578.cpp:180:1: error: 'requires' does not name a type
180 | requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
| ^~~~~~~~
p578.cpp:180:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:184:5: error: expected unqualified-id before 'using'
184 | using uninitialized_copy_n_result = in_out_result<I, O>;
| ^~~~~
p578.cpp:185:10: error: 'input_iterator' has not been declared
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~~~~~~~~
p578.cpp:185:28: error: 'nothrow' is not a type
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~
p578.cpp:185:35: error: expected '>' before '-' token
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:185:84: error: 'requires' does not name a type
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~~
p578.cpp:185:84: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:193:58: error: expected ',' or '...' before '&&' token
193 | NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see 27.3.5 ForwardIterator first, ForwardIterator last,
| ^~
p578.cpp:200:83: error: expected ',' or '...' before '&&' token
200 | pair<ForwardIterator, NoThrowForwardIterator> uninitialized_move_n(ExecutionPolicy&& exec, // see 27.3.5
| ^~
p578.cpp:204:5: error: expected unqualified-id before 'using'
204 | using uninitialized_move_result = in_out_result<I, O>;
| ^~~~~
p578.cpp:205:12: error: 'input_iterator' has not been declared
205 | template<input_iterator I, sentinel_for<I> S1,
| ^~~~~~~~~~~~~~
p578.cpp:205:30: error: 'sentinel_for' has not been declared
205 | template<input_iterator I, sentinel_for<I> S1,
| ^~~~~~~~~~~~
p578.cpp:205:42: error: expected '>' before '<' token
205 | template<input_iterator I, sentinel_for<I> S1,
| ^
p578.cpp:207:1: error: 'requires' does not name a type
207 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^~~~~~~~
p578.cpp:207:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:210:10: error: 'input_range' has not been declared
210 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~~~~~
p578.cpp:210:26: error: 'nothrow' is not a type
210 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~
p578.cpp:210:33: error: expected '>' before '-' token
210 | template<input_range IR, nothrow-forward-range OR>
| ^
p578.cpp:211:1: error: 'requires' does not name a type
211 | requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
| ^~~~~~~~
p578.cpp:211:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:215:5: error: expected unqualified-id before 'using'
215 | using uninitialized_move_n_result = in_out_result<I, O>;
| ^~~~~
p578.cpp:216:10: error: 'input_iterator' has not been declared
216 | template<input_iterator I,
| ^~~~~~~~~~~~~~
p578.cpp:217:1: error: 'nothrow' is not a type
217 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S>
| ^~~~~~~
p578.cpp:217:8: error: expected '>' before '-' token
217 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S>
| ^
p578.cpp:218:5: error: 'requires' does not name a type
218 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^~~~~~~~
p578.cpp:218:5: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:226:40: error: expected ',' or '...' before '&&' token
226 | void uninitialized_fill(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last,
| ^~
p578.cpp:233:37: error: expected ',' or '...' before '&&' token
233 | uninitialized_fill_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n,
| ^~
p578.cpp:236:10: error: 'nothrow' is not a type
236 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^~~~~~~
p578.cpp:236:17: error: expected '>' before '-' token
236 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^
p578.cpp:238:3: error: 'requires' does not name a type
238 | requires constructible_from<iter_value_t<I>, const T&>
| ^~~~~~~~
p578.cpp:238:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:240:10: error: 'nothrow' is not a type
240 | template<nothrow-forward-range R, class T>
| ^~~~~~~
p578.cpp:240:17: error: expected '>' before '-' token
240 | template<nothrow-forward-range R, class T>
| ^
p578.cpp:241:1: error: 'requires' does not name a type
241 | requires constructible_from<range_value_t<R>, const T&>
| ^~~~~~~~
p578.cpp:241:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:243:10: error: 'nothrow' is not a type
243 | template<nothrow-forward-iterator I, class T>
| ^~~~~~~
p578.cpp:243:17: error: expected '>' before '-' token
243 | template<nothrow-forward-iterator I, class T>
| ^
p578.cpp:244:1: error: 'requires' does not name a type
244 | requires constructible_from<iter_value_t<I>, const T&>
| ^~~~~~~~
p578.cpp:244:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:248:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
248 | template<class T, class... Args>
| ^~~
p578.cpp:249:3: error: 'constexpr' does not name a type
249 | constexpr T* construct_at(T* location, Args&&... args);
| ^~~~~~~~~
p578.cpp:249:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:251:26: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
251 | template<class T, class... Args>
| ^~~
p578.cpp:252:5: error: 'constexpr' does not name a type
252 | constexpr T* construct_at(T* location, Args&&... args);
| ^~~~~~~~~
p578.cpp:252:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:256:3: error: 'constexpr' does not name a type
256 | constexpr void destroy_at(T* location);
| ^~~~~~~~~
p578.cpp:256:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:258:3: error: 'constexpr' does not name a type
258 | constexpr void destroy(NoThrowForwardIterator first, NoThrowForwardIterator last);
| ^~~~~~~~~
p578.cpp:258:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:260:29: error: expected ',' or '...' before '&&' token
260 | void destroy(ExecutionPolicy&& exec, // see 27.3.5
| ^~
p578.cpp:263:1: error: 'constexpr' does not name a type
263 | constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n);
| ^~~~~~~~~
p578.cpp:263:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:263:205: error: expected ',' or '...' before '&&' token
263 | hrowForwardIterator first, Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n);
| ^~
p578.cpp:276:40: error: expected ')' before ';' token
276 | template<class T> struct default_delete;
| ^
| )
p578.cpp:263:189: note: to match this '('
263 | or destroy_n(NoThrowForwardIterator first, Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n);
| ^
p578.cpp:277:26: error: 'default_delete' is not a class template
277 | template<class T> struct default_delete<T[]>;
| ^~~~~~~~~~~~~~
p578.cpp:278:45: error: spurious '>>', use '>' to terminate a template argument list
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^~
p578.cpp:278:29: error: two or more data types in declaration of 'type name'
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^~~~~~~~~~~~~~~~~~
p578.cpp:278:64: error: expected '>' before ';' token
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^
p578.cpp:278:64: error: expected unqualified-id before ';' token
p578.cpp:278:99: error: 'unique_ptr' is not a class template
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^~~~~~~~~~
p578.cpp:278:99: error: 'std::unique_ptr' is not a template
p578.cpp:278:54: note: previous declaration here
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^~~~~~~~~~
p578.cpp:279:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
279 | template<class T, class... Args>
| ^~~
p578.cpp:280:3: error: 'constexpr' does not name a type
280 | constexpr unique_ptr<T> make_unique(Args&&... args);
| ^~~~~~~~~
p578.cpp:280:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:282:3: error: 'constexpr' does not name a type
282 | constexpr unique_ptr<T> make_unique(size_t n);
| ^~~~~~~~~
p578.cpp:282:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:283:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
283 | template<class T, class... Args>
| ^~~
p578.cpp:284:1: error: 'unspecified' does not name a type
284 | unspecified make_unique(Args&&...) = delete;
| ^~~~~~~~~~~
p578.cpp:286:3: error: 'constexpr' does not name a type
286 | constexpr unique_ptr<T> make_unique_for_overwrite();
| ^~~~~~~~~
p578.cpp:286:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:288:3: error: 'constexpr' does not name a type
288 | constexpr unique_ptr<T> make_unique_for_overwrite(size_t n);
| ^~~~~~~~~
p578.cpp:288:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:289:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
289 | template<class T, class... Args>
| ^~~
p578.cpp:290:1: error: 'unspecified' does not name a type
290 | unspecified make_unique_for_overwrite(Args&&...) = delete;
| ^~~~~~~~~~~
p578.cpp:292:3: error: 'constexpr' does not name a type
292 | constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
| ^~~~~~~~~
p578.cpp:292:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:294:3: error: 'constexpr' does not name a type
294 | constexpr bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~
p578.cpp:294:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:296:24: error: 'std::unique_ptr' is not a template
296 | bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:296:53: error: 'std::unique_ptr' is not a template
296 | bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:298:24: error: 'std::unique_ptr' is not a template
298 | bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:298:53: error: 'std::unique_ptr' is not a template
298 | bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:300:25: error: 'std::unique_ptr' is not a template
300 | bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:300:54: error: 'std::unique_ptr' is not a template
300 | bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:302:25: error: 'std::unique_ptr' is not a template
302 | bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:302:54: error: 'std::unique_ptr' is not a template
302 | bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~~~
p578.cpp:304:3: error: 'requires' does not name a type
304 | requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer,
| ^~~~~~~~
p578.cpp:304:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:312:3: error: 'constexpr' does not name a type
312 | constexpr bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
| ^~~~~~~~~
p578.cpp:312:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:314:3: error: 'constexpr' does not name a type
314 | constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t);
| ^~~~~~~~~
p578.cpp:314:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:316:3: error: 'constexpr' does not name a type
316 | constexpr bool operator<(nullptr_t, const unique_ptr<T, D>& y);
| ^~~~~~~~~
p578.cpp:316:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:318:3: error: 'constexpr' does not name a type
318 | constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t);
| ^~~~~~~~~
p578.cpp:318:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:320:3: error: 'constexpr' does not name a type
320 | constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& y);
| ^~~~~~~~~
p578.cpp:320:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:322:3: error: 'constexpr' does not name a type
322 | constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
| ^~~~~~~~~
p578.cpp:322:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:324:3: error: 'constexpr' does not name a type
324 | constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
| ^~~~~~~~~
p578.cpp:324:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:326:3: error: 'constexpr' does not name a type
326 | constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
| ^~~~~~~~~
p578.cpp:326:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:328:3: error: 'constexpr' does not name a type
328 | constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
| ^~~~~~~~~
p578.cpp:328:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p578.cpp:330:3: error: 'requires' does not name a type
330 | requires three_way_comparable<typename unique_ptr<T, D>::pointer>
| ^~~~~~~~
p578.cpp:330:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p578.cpp:334:66: error: 'std::unique_ptr' is not a template
334 | basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
| ^~~~~~~~~~
p578.cpp:340:24: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
340 | template<class T, class... Args>
| ^~~
p578.cpp:341:33: error: expected ',' or '...' before '&&' token
341 | shared_ptr<T> make_shared(Args&&... args);
| ^~
p578.cpp:341:43: error: parameter packs not expanded with '...':
341 | shared_ptr<T> make_shared(Args&&... args);
| ^
p578.cpp:341:43: note: 'Args'
p578.cpp:342:33: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
342 | template<class T, class A, class... Args>
| ^~~
p578.cpp:343:49: error: expected ',' or '...' before '&&' token
343 | shared_ptr<T> allocate_shared(const A& a, Args&&... args);
| ^~
p578.cpp:343:59: error: parameter packs not expanded with '...':
343 | shared_ptr<T> allocate_shared(const A& a, Args&&... args);
| ^
p578.cpp:343:59: note: 'Args'
p578.cpp:353:45: error: 'remove_extent_t' does not name a type
353 | shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u);
| ^~~~~~~~~~~~~~~
p578.cpp:353:60: error: expected ',' or '...' before '<' token
353 | shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u);
| ^
p578.cpp:356:39: error: 'remove_extent_t' does not name a type
356 | const remove_extent_t<T>& u);
| ^~~~~~~~~~~~~~~
p578.cpp:356:54: error: expected ',' or '...' before '<' token
356 | const remove_extent_t<T>& u);
| ^
p578.cpp:358:35: error: 'remove_extent_t' does not name a type
358 | shared_ptr<T> make_shared(const remove_extent_t<T>& u);
| ^~~~~~~~~~~~~~~
p578.cpp:358:50: error: expected ',' or '...' before '<' token
358 | shared_ptr<T> make_shared(const remove_extent_t<T>& u);
| ^
p578.cpp:360:51: error: 'remove_extent_t' does not name a type
360 | shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u);
| ^~~~~~~~~~~~~~~
p578.cpp:360:66: error: expected ',' or '...' before '<' token
360 | shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u);
| ^
p578.cpp:378:67: error: expected initializer before 'noexcept'
378 | bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
| ^~~~~~~~
p578.cpp:381:3: error: 'strong_ordering' does not name a type
381 | strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
| ^~~~~~~~~~~~~~~
p578.cpp:383:43: error: 'nullptr_t' has not been declared
383 | bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
| ^~~~~~~~~
p578.cpp:383:54: error: expected initializer before 'noexcept'
383 | bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
| ^~~~~~~~
p578.cpp:385:3: error: 'strong_ordering' does not name a type
385 | strong_ordering operator<=>(const shared_ptr<T>& x, nullptr_t) noexcept;
| ^~~~~~~~~~~~~~~
p578.cpp:388:49: error: expected initializer before 'noexcept'
388 | void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
| ^~~~~~~~
p578.cpp:391:61: error: expected initializer before 'noexcept'
391 | shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
| ^~~~~~~~
p578.cpp:393:50: error: expected ',' or '...' before '&&' token
393 | shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~
p578.cpp:393:56: error: expected initializer before 'noexcept'
393 | shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~~~~~~~
p578.cpp:395:62: error: expected initializer before 'noexcept'
395 | shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
| ^~~~~~~~
p578.cpp:397:51: error: expected ',' or '...' before '&&' token
397 | shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~
p578.cpp:397:57: error: expected initializer before 'noexcept'
397 | shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~~~~~~~
p578.cpp:399:60: error: expected initializer before 'noexcept'
399 | shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
| ^~~~~~~~
p578.cpp:401:49: error: expected ',' or '...' before '&&' token
401 | shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~
p578.cpp:401:55: error: expected initializer before 'noexcept'
401 | shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~~~~~~~
p578.cpp:403:66: error: expected initializer before 'noexcept'
403 | shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept;
| ^~~~~~~~
p578.cpp:405:55: error: expected ',' or '...' before '&&' token
405 | shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~
p578.cpp:405:61: error: expected initializer before 'noexcept'
405 | shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
| ^~~~~~~~
p578.cpp:408:42: error: expected initializer before 'noexcept'
408 | D* get_deleter(const shared_ptr<T>& p) noexcept;
| ^~~~~~~~
p578.cpp:415:61: error: expected initializer before 'noexcept'
415 | template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
| ^~~~~~~~
p578.cpp:422:40: error: 'std::unique_ptr' is not a template
422 | template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;
| ^~~~~~~~~~
p578.cpp:422:55: error: '>>' should be '> >' within a nested template argument list
422 | template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;
| ^~
| > >
p578.cpp:422:35: error: template parameters not deducible in partial specialization:
422 | template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;
| ^~~~~~~~~~~~~~~~~~~~~~
p578.cpp:422:35: note: 'T'
p578.cpp:422:35: note: 'D'
p578.cpp:422:101: error: '>>' should be '> >' within a nested template argument list
422 | template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;
| ^~
| > >
p578.cpp:426:45: error: '>>' should be '> >' within a nested template argument list
426 | template<class T> struct atomic<shared_ptr<T>>; template<class T> struct atomic<weak_ptr<T>>;
| ^~
| > >
p578.cpp:426:91: error: '>>' should be '> >' within a nested template argument list
426 | template<class T> struct atomic<shared_ptr<T>>; template<class T> struct atomic<weak_ptr<T>>;
| ^~
| > >
p578.cpp:428:43: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
428 | template<class Smart, class Pointer, class... Args>
| ^~~
p578.cpp:431:50: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
431 | template<class Pointer = void, class Smart, class... Args>
| ^~~
p578.cpp:432:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
432 | auto out_ptr(Smart& s, Args&&... args);
| ^~~~
| ----
p578.cpp:432:32: error: expected ',' or '...' before '&&' token
432 | auto out_ptr(Smart& s, Args&&... args);
| ^~
p578.cpp:432:10: error: ISO C++ forbids declaration of 'out_ptr' with no type [-fpermissive]
432 | auto out_ptr(Smart& s, Args&&... args);
| ^~~~~~~
p578.cpp:432:5: error: top-level declaration of 'out_ptr' specifies 'auto'
432 | auto out_ptr(Smart& s, Args&&... args);
| ^~~~
p578.cpp:432:5: error: storage class 'auto' invalid for function 'out_ptr'
p578.cpp:432:42: error: no default argument for 'Smart'
432 | auto out_ptr(Smart& s, Args&&... args);
| ^
p578.cpp:432:42: error: default template arguments may not be used in function templates without '-std=c++11' or '-std=gnu++11'
p578.cpp:432:42: error: parameter packs not expanded with '...':
p578.cpp:432:42: note: 'Args'
p578.cpp:434:43: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
434 | template<class Smart, class Pointer, class... Args>
| ^~~
p578.cpp:437:50: warning: variadic templates only available with '-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
437 | template<class Pointer = void, class Smart, class... Args>
| ^~~
p578.cpp:438:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
438 | auto inout_ptr(Smart& s, Args&&... args);
| ^~~~
| ----
p578.cpp:438:34: error: expected ',' or '...' before '&&' token
438 | auto inout_ptr(Smart& s, Args&&... args);
| ^~
p578.cpp:438:10: error: ISO C++ forbids declaration of 'inout_ptr' with no type [-fpermissive]
438 | auto inout_ptr(Smart& s, Args&&... args);
| ^~~~~~~~~
p578.cpp:438:5: error: top-level declaration of 'inout_ptr' specifies 'auto'
438 | auto inout_ptr(Smart& s, Args&&... args);
| ^~~~
p578.cpp:438:5: error: storage class 'auto' invalid for function 'inout_ptr'
p578.cpp:438:44: error: no default argument for 'Smart'
438 | auto inout_ptr(Smart& s, Args&&... args);
| ^
p578.cpp:438:44: error: default template arguments may not be used in function templates without '-std=c++11' or '-std=gnu++11'
p578.cpp:438:44: error: parameter packs not expanded with '...':
p578.cpp:438:44: note: 'Args'
rm: cannot remove 'p578g': No such file or directory
$ g++ p578.cpp -std=c++2b -o p578g -I. -Wall
p578.cpp:43:8: error: redefinition of 'struct std::allocator_arg_t'
43 | struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
| ^~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/tuple:39,
from /usr/local/include/c++/12.1.0/bits/stl_map.h:63,
from /usr/local/include/c++/12.1.0/map:61,
from p578.cpp:18:
/usr/local/include/c++/12.1.0/bits/uses_allocator.h:51:10: note: previous definition of 'struct std::allocator_arg_t'
51 | struct allocator_arg_t { explicit allocator_arg_t() = default; };
| ^~~~~~~~~~~~~~~
p578.cpp:43:100: error: redefinition of 'constexpr const std::allocator_arg_t std::allocator_arg'
43 | struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/uses_allocator.h:53:47: note: 'constexpr const std::allocator_arg_t std::allocator_arg' previously defined here
53 | _GLIBCXX17_INLINE constexpr allocator_arg_t allocator_arg =
| ^~~~~~~~~~~~~
p578.cpp:48:25: error: redefinition of 'template<class T, class Alloc> constexpr const bool std::uses_allocator_v'
48 | inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/uses_allocator.h:128:27: note: 'template<class _Tp, class _Alloc> constexpr const bool std::uses_allocator_v<_Tp, _Alloc>' previously declared here
128 | inline constexpr bool uses_allocator_v =
| ^~~~~~~~~~~~~~~~
p578.cpp:88:15: error: expected ']' before 'constexpr'
88 | [[nodiscard] constexpr allocation_result<typename allocator_traits<Allocator>::pointer>
| ^~~~~~~~~~
| ]
p578.cpp:89:46: error: expected unqualified-id before ';' token
89 | allocate_at_least(Allocator& a, size_t n);
| ^
p578.cpp:98:12: error: redefinition of 'template<class T> const T* std::addressof(const T&&)'
98 | const T* addressof(const T&&) = delete;
| ^~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/exception_ptr.h:43,
from /usr/local/include/c++/12.1.0/exception:168,
from /usr/local/include/c++/12.1.0/ios:39,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from p578.cpp:10:
/usr/local/include/c++/12.1.0/bits/move.h:151:16: note: 'template<class _Tp> const _Tp* std::addressof(const _Tp&&)' previously declared here
151 | const _Tp* addressof(const _Tp&&) = delete;
| ^~~~~~~~~
p578.cpp:102:16: error: expected '=' before '-' token
102 | concept nothrow-input-iterator = see below ; template<class I>
| ^
p578.cpp:104:16: error: expected '=' before '-' token
104 | concept nothrow-forward-iterator = see_below;
| ^
p578.cpp:106:16: error: expected '=' before '-' token
106 | concept nothrow-sentinel-for = see_below;
| ^
p578.cpp:108:16: error: expected '=' before '-' token
108 | concept nothrow-input-range = see_below;
| ^
p578.cpp:110:16: error: expected '=' before '-' token
110 | concept nothrow-forward-range = see_below ;
| ^
p578.cpp:127:10: error: 'nothrow' is not a type
127 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I> S>
| ^~~~~~~
p578.cpp:127:17: error: expected '>' before '-' token
127 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I> S>
| ^
p578.cpp:128:49: error: 'I' was not declared in this scope
128 | requires default_initializable<iter_value_t<I>>
| ^
p578.cpp:128:49: error: template argument 1 is invalid
p578.cpp:128:14: error: template argument 1 is invalid
128 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:129:7: error: 'I' does not name a type
129 | I uninitialized_default_construct(I first, S last);
| ^
p578.cpp:130:10: error: 'nothrow' is not a type
130 | template<nothrow-forward-range R>
| ^~~~~~~
p578.cpp:130:17: error: expected '>' before '-' token
130 | template<nothrow-forward-range R>
| ^
p578.cpp:131:46: error: 'R' was not declared in this scope
131 | requires default_initializable<range_value_t<R>>
| ^
p578.cpp:131:46: error: template argument 1 is invalid
p578.cpp:131:10: error: template argument 1 is invalid
131 | requires default_initializable<range_value_t<R>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:132:27: error: 'R' was not declared in this scope
132 | borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
| ^
p578.cpp:132:28: error: template argument 1 is invalid
132 | borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
| ^
p578.cpp:132:62: error: 'template<<typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_default_construct' redeclared as different kind of entity
132 | borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
| ^
In file included from /usr/local/include/c++/12.1.0/memory:86,
from p578.cpp:22:
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:170:5: note: previous declaration 'constexpr const std::ranges::__uninitialized_default_construct_fn std::ranges::uninitialized_default_construct'
170 | uninitialized_default_construct{};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:132:62: error: 'R' was not declared in this scope
132 | borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
| ^
p578.cpp:132:66: error: 'r' was not declared in this scope
132 | borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
| ^
p578.cpp:133:10: error: 'nothrow' is not a type
133 | template<nothrow-forward-iterator I>
| ^~~~~~~
p578.cpp:133:17: error: expected '>' before '-' token
133 | template<nothrow-forward-iterator I>
| ^
p578.cpp:134:45: error: 'I' was not declared in this scope
134 | requires default_initializable<iter_value_t<I>>
| ^
p578.cpp:134:45: error: template argument 1 is invalid
p578.cpp:134:10: error: template argument 1 is invalid
134 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:135:7: error: 'I' does not name a type
135 | I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
| ^
p578.cpp:142:1: error: expected identifier before 'template'
142 | template<class NoThrowForwardIterator, class Size>
| ^~~~~~~~
p578.cpp:142:1: error: expected ',' or '...' before 'template'
p578.cpp:144:74: error: expected ')' before ';' token
144 | uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
| ^
| )
p578.cpp:141:35: note: to match this '('
141 | void uninitialized_value_construct(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, NoThrowForwardIterator last);
| ^
p578.cpp:149:10: error: 'nothrow' is not a type
149 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^~~~~~~
p578.cpp:149:17: error: expected '>' before '-' token
149 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^
p578.cpp:151:55: error: expected unqualified-id before ';' token
151 | I uninitialized_value_construct(I first, S last);
| ^
p578.cpp:152:10: error: 'nothrow' is not a type
152 | template<nothrow-forward-range R>
| ^~~~~~~
p578.cpp:152:17: error: expected '>' before '-' token
152 | template<nothrow-forward-range R>
| ^
p578.cpp:153:46: error: 'R' was not declared in this scope
153 | requires default_initializable<range_value_t<R>>
| ^
p578.cpp:153:46: error: template argument 1 is invalid
p578.cpp:153:10: error: template argument 1 is invalid
153 | requires default_initializable<range_value_t<R>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:154:27: error: 'R' was not declared in this scope
154 | borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
| ^
p578.cpp:154:28: error: template argument 1 is invalid
154 | borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
| ^
p578.cpp:154:60: error: 'template<<typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_value_construct' redeclared as different kind of entity
154 | borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:228:5: note: previous declaration 'constexpr const std::ranges::__uninitialized_value_construct_fn std::ranges::uninitialized_value_construct'
228 | uninitialized_value_construct{};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:154:60: error: 'R' was not declared in this scope
154 | borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
| ^
p578.cpp:154:64: error: 'r' was not declared in this scope
154 | borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
| ^
p578.cpp:155:10: error: 'nothrow' is not a type
155 | template<nothrow-forward-iterator I>
| ^~~~~~~
p578.cpp:155:17: error: expected '>' before '-' token
155 | template<nothrow-forward-iterator I>
| ^
p578.cpp:156:45: error: 'I' was not declared in this scope
156 | requires default_initializable<iter_value_t<I>>
| ^
p578.cpp:156:45: error: template argument 1 is invalid
p578.cpp:156:10: error: template argument 1 is invalid
156 | requires default_initializable<iter_value_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:157:7: error: 'I' does not name a type
157 | I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
| ^
p578.cpp:176:1: error: 'nothrow' is not a type
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~
p578.cpp:176:8: error: expected '>' before '-' token
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:176:99: error: 'O' was not declared in this scope
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:176:100: error: template argument 1 is invalid
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:176:67: error: template argument 1 is invalid
176 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:177:36: error: 'O' was not declared in this scope
177 | uninitialized_copy_result<I, O>
| ^
p578.cpp:177:37: error: template argument 2 is invalid
177 | uninitialized_copy_result<I, O>
| ^
p578.cpp:178:48: error: 'O' has not been declared
178 | uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^
p578.cpp:178:58: error: 'S2' has not been declared
178 | uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^~
p578.cpp:178:66: error: 'template<class I, class S1, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_copy(I, S1, int, int)' redeclared as different kind of entity
178 | uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:303:44: note: previous declaration 'constexpr const std::ranges::__uninitialized_copy_fn std::ranges::uninitialized_cop'
303 | inline constexpr __uninitialized_copy_fn uninitialized_copy{};
| ^~~~~~~~~~~~~~~~~~
p578.cpp:179:26: error: 'nothrow' is not a type
179 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~
p578.cpp:179:33: error: expected '>' before '-' token
179 | template<input_range IR, nothrow-forward-range OR>
| ^
p578.cpp:180:43: error: 'OR' was not declared in this scope; did you mean 'IR'?
180 | requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
| ^~
| IR
p578.cpp:180:45: error: template argument 1 is invalid
180 | requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
| ^
p578.cpp:180:10: error: template argument 1 is invalid
180 | requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:181:78: error: 'OR' was not declared in this scope; did you mean 'IR'?
181 | uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
| ^~
| IR
p578.cpp:181:78: error: template argument 1 is invalid
p578.cpp:181:80: error: template argument 2 is invalid
181 | uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
| ^~
p578.cpp:182:43: error: 'OR' has not been declared
182 | uninitialized_copy(IR&& in_range, OR&& out_range);
| ^~
p578.cpp:182:57: error: 'template<class IR, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_copy(IR&&, int&&)' redeclared as different kind of entity
182 | uninitialized_copy(IR&& in_range, OR&& out_range);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:303:44: note: previous declaration 'constexpr const std::ranges::__uninitialized_copy_fn std::ranges::uninitialized_cop'
303 | inline constexpr __uninitialized_copy_fn uninitialized_copy{};
| ^~~~~~~~~~~~~~~~~~
p578.cpp:185:28: error: 'nothrow' is not a type
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~
p578.cpp:185:35: error: expected '>' before '-' token
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:185:125: error: 'O' was not declared in this scope
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:185:126: error: template argument 1 is invalid
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^
p578.cpp:185:93: error: template argument 1 is invalid
185 | template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for <O> S> requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:186:38: error: 'O' was not declared in this scope
186 | uninitialized_copy_n_result<I, O>
| ^
p578.cpp:186:39: error: template argument 2 is invalid
186 | uninitialized_copy_n_result<I, O>
| ^
p578.cpp:187:64: error: 'O' has not been declared
187 | uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
p578.cpp:187:74: error: 'S' has not been declared
187 | uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
p578.cpp:187:81: error: 'template<class I, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_copy_n(I, std::iter_difference_t<_Iter>, int, int)' redeclared as different kind of entity
187 | uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:339:46: note: previous declaration 'constexpr const std::ranges::__uninitialized_copy_n_fn std::ranges::uninitialized_copy_n'
339 | inline constexpr __uninitialized_copy_n_fn uninitialized_copy_n{};
| ^~~~~~~~~~~~~~~~~~~~
p578.cpp:206:1: error: 'nothrow' is not a type
206 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2>
| ^~~~~~~
p578.cpp:206:8: error: expected '>' before '-' token
206 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S2>
| ^
p578.cpp:207:42: error: 'O' was not declared in this scope
207 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^
p578.cpp:207:43: error: template argument 1 is invalid
207 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^
p578.cpp:207:10: error: template argument 1 is invalid
207 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:208:36: error: 'O' was not declared in this scope
208 | uninitialized_move_result<I, O>
| ^
p578.cpp:208:37: error: template argument 2 is invalid
208 | uninitialized_move_result<I, O>
| ^
p578.cpp:209:48: error: 'O' has not been declared
209 | uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^
p578.cpp:209:58: error: 'S2' has not been declared
209 | uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^~
p578.cpp:209:66: error: 'template<class I, class S1, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_move(I, S1, int, int)' redeclared as different kind of entity
209 | uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:393:44: note: previous declaration 'constexpr const std::ranges::__uninitialized_move_fn std::ranges::uninitialized_mov'
393 | inline constexpr __uninitialized_move_fn uninitialized_move{};
| ^~~~~~~~~~~~~~~~~~
p578.cpp:210:26: error: 'nothrow' is not a type
210 | template<input_range IR, nothrow-forward-range OR>
| ^~~~~~~
p578.cpp:210:33: error: expected '>' before '-' token
210 | template<input_range IR, nothrow-forward-range OR>
| ^
p578.cpp:211:43: error: 'OR' was not declared in this scope; did you mean 'IR'?
211 | requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
| ^~
| IR
p578.cpp:211:45: error: template argument 1 is invalid
211 | requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
| ^
p578.cpp:211:10: error: template argument 1 is invalid
211 | requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:212:78: error: 'OR' was not declared in this scope; did you mean 'IR'?
212 | uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
| ^~
| IR
p578.cpp:212:78: error: template argument 1 is invalid
p578.cpp:212:80: error: template argument 2 is invalid
212 | uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
| ^~
p578.cpp:213:43: error: 'OR' has not been declared
213 | uninitialized_move(IR&& in_range, OR&& out_range);
| ^~
p578.cpp:213:57: error: 'template<class IR, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_move(IR&&, int&&)' redeclared as different kind of entity
213 | uninitialized_move(IR&& in_range, OR&& out_range);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:393:44: note: previous declaration 'constexpr const std::ranges::__uninitialized_move_fn std::ranges::uninitialized_mov'
393 | inline constexpr __uninitialized_move_fn uninitialized_move{};
| ^~~~~~~~~~~~~~~~~~
p578.cpp:217:1: error: 'nothrow' is not a type
217 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S>
| ^~~~~~~
p578.cpp:217:8: error: expected '>' before '-' token
217 | nothrow-forward-iterator O, nothrow-sentinel-for <O> S>
| ^
p578.cpp:218:46: error: 'O' was not declared in this scope
218 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^
p578.cpp:218:47: error: template argument 1 is invalid
218 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^
p578.cpp:218:14: error: template argument 1 is invalid
218 | requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:219:38: error: 'O' was not declared in this scope
219 | uninitialized_move_n_result<I, O>
| ^
p578.cpp:219:39: error: template argument 2 is invalid
219 | uninitialized_move_n_result<I, O>
| ^
p578.cpp:220:64: error: 'O' has not been declared
220 | uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
p578.cpp:220:74: error: 'S' has not been declared
220 | uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
p578.cpp:220:81: error: 'template<class I, <typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_move_n(I, std::iter_difference_t<_Iter>, int, int)' redeclared as different kind of entity
220 | uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:433:46: note: previous declaration 'constexpr const std::ranges::__uninitialized_move_n_fn std::ranges::uninitialized_move_n'
433 | inline constexpr __uninitialized_move_n_fn uninitialized_move_n{};
| ^~~~~~~~~~~~~~~~~~~~
p578.cpp:236:10: error: 'nothrow' is not a type
236 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^~~~~~~
p578.cpp:236:17: error: expected '>' before '-' token
236 | template<nothrow-forward-iterator I, nothrow-sentinel-for <I>
| ^
p578.cpp:238:44: error: 'I' was not declared in this scope
238 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:238:45: error: template argument 1 is invalid
238 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:238:54: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
238 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:238:12: error: parse error in template argument list
238 | requires constructible_from<iter_value_t<I>, const T&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:238:12: error: template argument 1 is invalid
p578.cpp:238:12: error: template argument 2 is invalid
p578.cpp:239:5: error: 'I' does not name a type
239 | I uninitialized_fill(I first, S last, const T& x);
| ^
p578.cpp:240:10: error: 'nothrow' is not a type
240 | template<nothrow-forward-range R, class T>
| ^~~~~~~
p578.cpp:240:17: error: expected '>' before '-' token
240 | template<nothrow-forward-range R, class T>
| ^
p578.cpp:241:43: error: 'R' was not declared in this scope
241 | requires constructible_from<range_value_t<R>, const T&>
| ^
p578.cpp:241:44: error: template argument 1 is invalid
241 | requires constructible_from<range_value_t<R>, const T&>
| ^
p578.cpp:241:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
241 | requires constructible_from<range_value_t<R>, const T&>
| ^
p578.cpp:241:10: error: parse error in template argument list
241 | requires constructible_from<range_value_t<R>, const T&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:241:10: error: template argument 1 is invalid
p578.cpp:241:10: error: template argument 2 is invalid
p578.cpp:242:27: error: 'R' was not declared in this scope
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^
p578.cpp:242:28: error: template argument 1 is invalid
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^
p578.cpp:242:49: error: 'template<<typeprefixerror><anonymous> > requires <erroneous-expression> int std::ranges::uninitialized_fill' redeclared as different kind of entity
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:466:44: note: previous declaration 'constexpr const std::ranges::__uninitialized_fill_fn std::ranges::uninitialized_fil'
466 | inline constexpr __uninitialized_fill_fn uninitialized_fill{};
| ^~~~~~~~~~~~~~~~~~
p578.cpp:242:49: error: 'R' was not declared in this scope
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^
p578.cpp:242:53: error: 'r' was not declared in this scope
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^
p578.cpp:242:56: error: expected primary-expression before 'const'
242 | borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
| ^~~~~
p578.cpp:243:10: error: 'nothrow' is not a type
243 | template<nothrow-forward-iterator I, class T>
| ^~~~~~~
p578.cpp:243:17: error: expected '>' before '-' token
243 | template<nothrow-forward-iterator I, class T>
| ^
p578.cpp:244:42: error: 'I' was not declared in this scope
244 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:244:43: error: template argument 1 is invalid
244 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:244:52: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
244 | requires constructible_from<iter_value_t<I>, const T&>
| ^
p578.cpp:244:10: error: parse error in template argument list
244 | requires constructible_from<iter_value_t<I>, const T&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p578.cpp:244:10: error: template argument 1 is invalid
p578.cpp:244:10: error: template argument 2 is invalid
p578.cpp:245:7: error: 'I' does not name a type
245 | I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
| ^
p578.cpp:252:58: error: 'template<class T, class ... Args> constexpr T* std::ranges::construct_at(T*, Args&& ...)' redeclared as different kind of entity
252 | constexpr T* construct_at(T* location, Args&&... args);
| ^
/usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:509:38: note: previous declaration 'constexpr const std::ranges::__construct_at_fn std::ranges::construct_at'
509 | inline constexpr __construct_at_fn construct_at{};
| ^~~~~~~~~~~~
p578.cpp:264:1: error: expected identifier before 'namespace'
264 | namespace ranges {
| ^~~~~~~~~
p578.cpp:264:1: error: expected ',' or '...' before 'namespace'
p578.cpp:276:40: error: expected ')' before ';' token
276 | template<class T> struct default_delete;
| ^
| )
p578.cpp:263:189: note: to match this '('
263 | or destroy_n(NoThrowForwardIterator first, Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see 27.3.5 NoThrowForwardIterator first, Size n);
| ^
p578.cpp:278:19: error: redefinition of default argument for 'class D'
278 | template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;
| ^~~~~
In file included from /usr/local/include/c++/12.1.0/memory:76:
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:268:27: note: original definition appeared here
268 | template <typename _Tp, typename _Dp = default_delete<_Tp>>
| ^~~~~~~~
p578.cpp:284:1: error: 'unspecified' does not name a type
284 | unspecified make_unique(Args&&...) = delete;
| ^~~~~~~~~~~
p578.cpp:290:1: error: 'unspecified' does not name a type
290 | unspecified make_unique_for_overwrite(Args&&...) = delete;
| ^~~~~~~~~~~
p578.cpp:296:8: error: redeclaration 'bool std::operator<(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)' differs in 'constexpr' from previous declaration
296 | bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:872:5: note: previous declaration 'constexpr bool std::operator<(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)'
872 | operator<(const unique_ptr<_Tp, _Dp>& __x,
| ^~~~~~~~
p578.cpp:298:8: error: redeclaration 'bool std::operator>(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)' differs in 'constexpr' from previous declaration
298 | bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:929:5: note: previous declaration 'constexpr bool std::operator>(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)'
929 | operator>(const unique_ptr<_Tp, _Dp>& __x,
| ^~~~~~~~
p578.cpp:300:8: error: redeclaration 'bool std::operator<=(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)' differs in 'constexpr' from previous declaration
300 | bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:906:5: note: previous declaration 'constexpr bool std::operator<=(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)'
906 | operator<=(const unique_ptr<_Tp, _Dp>& __x,
| ^~~~~~~~
p578.cpp:302:8: error: redeclaration 'bool std::operator>=(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)' differs in 'constexpr' from previous declaration
302 | bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:958:5: note: previous declaration 'constexpr bool std::operator>=(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)'
958 | operator>=(const unique_ptr<_Tp, _Dp>& __x,
| ^~~~~~~~
p578.cpp:308:1: error: redeclaration 'std::compare_three_way_result_t<typename std::unique_ptr<_Tp, _Dp>::pointer, typename std::unique_ptr<_Up, _Ep>::pointer> std::operator<=>(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)' differs in 'constexpr' from previous declaration
308 | operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:983:5: note: previous declaration 'constexpr std::compare_three_way_result_t<typename std::unique_ptr<_Tp, _Dp>::pointer, typename std::unique_ptr<_Up, _Ep>::pointer> std::operator<=>(const unique_ptr<_Tp, _Dp>&, const unique_ptr<_Up, _Ep>&)'
983 | operator<=>(const unique_ptr<_Tp, _Dp>& __x,
| ^~~~~~~~
p578.cpp:328:18: error: redeclaration 'constexpr bool std::operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>&)' differs in 'constexpr' from previous declaration
328 | constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/unique_ptr.h:972:5: note: previous declaration 'bool std::operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>&)'
972 | operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x)
| ^~~~~~~~
p578.cpp:417:10: error: redefinition of default argument for 'class T'
417 | template<class T = void> struct owner_less;
| ^~~~~
In file included from /usr/local/include/c++/12.1.0/bits/shared_ptr.h:53,
from /usr/local/include/c++/12.1.0/memory:77:
/usr/local/include/c++/12.1.0/bits/shared_ptr_base.h:400:12: note: original definition appeared here
400 | template<typename _Tp>
| ^~~~~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
Script
#!/bin/sh
rm $1l
rm $1g
echo "$ clang++ $1.cpp -std=03 -o $1l -I. -Wall"
clang++ $1.cpp -std=c++03 -o $1l -I. -Wall
if [ -e $1l ]; then
./$1l
fi
rm $1l
echo "$ clang++ $1.cpp -std=2b -o $1l -I. -Wall"
clang++ $1.cpp -std=c++2b -o $1l -I. -Wall
if [ -e $1l ]; then
./$1l
fi
echo "\r"
echo "$ g++ $1.cpp -std=03 -o $1g -I. -Wall"
g++ $1.cpp -std=c++03 -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
rm $1g
echo "\r"
echo "$ g++ $1.cpp -std=2b -o $1g -I. -Wall"
g++ $1.cpp -std=c++2b -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
参考資料(reference)
cpprefjp - C++日本語リファレンス
コンパイラの実装状況
typedef は C++11 ではオワコン
C99からC++14を駆け抜けるC++講座
自己参照(self reference)
コピペコンパイルエラーあるある
C++ Error Message Collection(1)does not name a type, 11 articles
dockerにclang
docker gnu(gcc/g++) and llvm(clang/clang++)
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015
C++ sample list
clang++, g++コンパイルエラー方針の違いの例
astyle 使ってみた
C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da
Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f
C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff
Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d
cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67
MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74
C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed
ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1
C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a
C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9
'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11
Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc
MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb
どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00
MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220716