#はじめに(Introduction)
C++N4606 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/#mailing2016-11
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
C++N4606は、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)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。
##作業方針(sequence)
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
C++N4606符号断片編纂一覧(example code compile list)
C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
編纂器(Compiler)
###clang++ --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.4.0
###g++-7 --version
g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
#(241) 20.2 Utility components [utility]p534
##算譜(source code)
// C++N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "C++N4606(241) 20.2 Utility components [utility]p534.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.
#include <iostream>
#include <cstdlib>
#include <system_error>
#include <string>
#include <initializer_list>
namespace std {
// 20.2.1, operators:
namespace rel_ops {
template<class T> bool operator!=(const T&, const T&);
template<class T> bool operator> (const T&, const T&);
template<class T> bool operator<=(const T&, const T&);
template<class T> bool operator>=(const T&, const T&);
}
// 20.2.2, swap:
template <class T> void swap(T& a, T& b) noexcept(see below );
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
// 20.2.3, exchange:
template <class T, class U=T> T exchange(T& obj, U&& new_val);
// 20.2.4, forward/move:
template <class T>
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
template <class T>
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
template <class T>
constexpr remove_reference_t<T>&& move(T&&) noexcept;
template <class T>
constexpr conditional_t<
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
const T&, T&&> move_if_noexcept(T& x) noexcept;
// 20.2.5, as_const:
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
template <class T> void as_const(const T&&) = delete;
// 20.2.6, declval:
template <class T>
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
// 20.3, Compile-time integer sequences
template<class T, T...> struct integer_sequence;
template<size_t... I>
using index_sequence = integer_sequence<size_t, I...>;
template<class T, T N>
using make_integer_sequence = integer_sequence<T, see below >;
template<size_t N>
using make_index_sequence = make_integer_sequence<size_t, N>;
template<class... T>
using index_sequence_for = make_index_sequence<sizeof...(T)>;
// 20.4, pairs:
template <class T1, class T2> struct pair;
// 20.4.3, pair specialized algorithms:
template <class T1, class T2>
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator>=(const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator<=(const pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
template <class T1, class T2>
constexpr see below make_pair(T1&&, T2&&);
// 20.4.4, tuple-like access to pair:
template <class T> class tuple_size;
template <size_t I, class T> class tuple_element;
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&
get(pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&&
get(pair<T1, T2>&&) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&
get(const pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&&
get(const pair<T1, T2>&&) noexcept;
template <class T, class U>
constexpr T& get(pair<T, U>& p) noexcept;
template <class T, class U>
constexpr const T& get(const pair<T, U>& p) noexcept;
template <class T, class U>
constexpr T&& get(pair<T, U>&& p) noexcept;
template <class T, class U>
constexpr const T&& get(const pair<T, U>&& p) noexcept;
template <class T, class U>
constexpr T& get(pair<U, T>& p) noexcept;
template <class T, class U>
constexpr const T& get(const pair<U, T>& p) noexcept;
template <class T, class U>
constexpr T&& get(pair<U, T>&& p) noexcept;
template <class T, class U>
constexpr const T&& get(const pair<U, T>&& p) noexcept;
// 20.4.5, pair piecewise construction
struct piecewise_construct_t { };
constexpr piecewise_construct_t piecewise_construct{};
template <class... Types> class tuple; // defined in <tuple>
// 20.2.7, in-place construction
struct in_place_tag {
in_place_tag() = delete;
};
using in_place_t = in_place_tag(&)(unspecified );
template <class T>
using in_place_type_t = in_place_tag(&)(unspecified <T>);
template <size_t I>
using in_place_index_t = in_place_tag(&)(unspecified <I>);
in_place_tag in_place(unspecified );
template <class T>
in_place_tag in_place(unspecified <T>);
template <size_t I>
in_place_tag in_place(unspecified <I>);
}
int main() {
std::cout<< msg << std::endl;
return EXIT_SUCCESS;
}
##編纂・実行結果(compile and go)
i$ ./cppall.sh p534
$ clang++ p534.cpp -std=c++03 -Wall
p534.cpp:22:41: error: expected ';' at end of declaration
template <class T> void swap(T& a, T& b) noexcept(see below );
^
;
p534.cpp:22:51: error: unknown type name 'see'
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:22:42: error: C++ requires a type specifier for all declarations
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:23:61: error: expected ';' at end of declaration
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
;
p534.cpp:23:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:23:94: error: use of undeclared identifier 'T'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:23:62: error: unknown type name 'noexcept'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:23:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:23:94: error: use of undeclared identifier 'T'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:23:96: error: expected unqualified-id
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:25:51: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^
p534.cpp:25:26: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions]
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^ ~
p534.cpp:28:1: error: unknown type name 'constexpr'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:28:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:28:12: error: expected ';' at end of declaration
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
;
p534.cpp:28:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
p534.cpp:28:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:28:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:28:49: error: expected function body after function declarator
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:30:1: error: unknown type name 'constexpr'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:30:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:30:12: error: expected ';' at end of declaration
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
;
p534.cpp:30:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
p534.cpp:30:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:30:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:30:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
$ clang++ p534.cpp -std=c++11 -Wall
p534.cpp:22:51: error: use of undeclared identifier 'see'
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:22:55: error: expected ')'
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:22:50: note: to match this '('
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:23:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:23:96: error: expected '(' for function-style cast or type construction
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
~~~~~~~~~~~~~~~~~~~~~~~~~^
p534.cpp:28:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:30:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:32:11: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:34:11: error: no template named 'conditional_t'; did you mean 'conditional'?
constexpr conditional_t<
^~~~~~~~~~~~~
conditional
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:424:33: note: 'conditional' declared here
struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
^
p534.cpp:35:2: error: no template named 'is_nothrow_move_constructible_v'; did you mean 'is_nothrow_move_constructible'?
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
is_nothrow_move_constructible
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:3891:50: note: 'is_nothrow_move_constructible' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
^
p534.cpp:35:37: error: expected '(' for function-style cast or type construction
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
p534.cpp:35:40: error: no template named 'is_copy_constructible_v'; did you mean 'is_copy_constructible'?
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
^~~~~~~~~~~~~~~~~~~~~~~
is_copy_constructible
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:3399:29: note: 'is_copy_constructible' declared here
struct _LIBCPP_TEMPLATE_VIS is_copy_constructible
^
p534.cpp:35:66: error: expected '(' for function-style cast or type construction
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
~~~~~~~~~~~~~~~~~~~~~~~~~~^
p534.cpp:38:30: error: no template named 'add_const_t'; did you mean 'add_const'?
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~~~
add_const
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1069:50: note: 'add_const' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
^
p534.cpp:42:1: error: no template named 'add_rvalue_reference_t'; did you mean 'add_rvalue_reference'?
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
add_rvalue_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1131:50: note: 'add_rvalue_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
^
p534.cpp:48:51: error: unknown type name 'see'
using make_integer_sequence = integer_sequence<T, see below >;
^
p534.cpp:48:55: error: type-id cannot have a name
using make_integer_sequence = integer_sequence<T, see below >;
^~~~~~
p534.cpp:50:29: error: no template named 'make_integer_sequence'; did you mean '__integer_sequence'?
using make_index_sequence = make_integer_sequence<size_t, N>;
^~~~~~~~~~~~~~~~~~~~~
__integer_sequence
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:93:8: note: '__integer_sequence' declared here
struct __integer_sequence {
^
p534.cpp:57:33: error: no template named 'pair'
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:57:54: error: no template named 'pair'
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p534.cpp -std=c++17 -Wall
p534.cpp:22:51: error: use of undeclared identifier 'see'
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:22:55: error: expected ')'
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:22:50: note: to match this '('
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:46:24: error: no template named 'integer_sequence'; did you mean '__integer_sequence'?
using index_sequence = integer_sequence<size_t, I...>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:93:8: note: '__integer_sequence' declared here
struct __integer_sequence {
^
p534.cpp:48:31: error: no template named 'integer_sequence'; did you mean '__integer_sequence'?
using make_integer_sequence = integer_sequence<T, see below >;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:93:8: note: '__integer_sequence' declared here
struct __integer_sequence {
^
p534.cpp:48:51: error: unknown type name 'see'
using make_integer_sequence = integer_sequence<T, see below >;
^
p534.cpp:48:55: error: type-id cannot have a name
using make_integer_sequence = integer_sequence<T, see below >;
^~~~~~
p534.cpp:52:28: error: no template named 'make_index_sequence'; did you mean 'make_integer_sequence'?
using index_sequence_for = make_index_sequence<sizeof...(T)>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:881:5: note: 'make_integer_sequence' declared here
using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
^
p534.cpp:57:33: error: reference to 'pair' is ambiguous
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:54:38: note: candidate found by name lookup is 'std::pair'
template <class T1, class T2> struct pair;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:312:29: note: candidate found by name lookup is 'std::__1::pair'
struct _LIBCPP_TEMPLATE_VIS pair
^
p534.cpp:57:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~
p534.cpp:54:38: note: template is declared here
template <class T1, class T2> struct pair;
^
p534.cpp:57:37: error: expected ')'
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:57:26: note: to match this '('
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:59:33: error: reference to 'pair' is ambiguous
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:54:38: note: candidate found by name lookup is 'std::pair'
template <class T1, class T2> struct pair;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:312:29: note: candidate found by name lookup is 'std::__1::pair'
struct _LIBCPP_TEMPLATE_VIS pair
^
p534.cpp:59:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
^~~~
p534.cpp:54:38: note: template is declared here
template <class T1, class T2> struct pair;
^
p534.cpp:59:37: error: expected ')'
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:59:26: note: to match this '('
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:61:33: error: reference to 'pair' is ambiguous
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:54:38: note: candidate found by name lookup is 'std::pair'
template <class T1, class T2> struct pair;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:312:29: note: candidate found by name lookup is 'std::__1::pair'
struct _LIBCPP_TEMPLATE_VIS pair
^
p534.cpp:61:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~
p534.cpp:54:38: note: template is declared here
template <class T1, class T2> struct pair;
^
p534.cpp:61:37: error: expected ')'
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:61:26: note: to match this '('
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:63:33: error: reference to 'pair' is ambiguous
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:54:38: note: candidate found by name lookup is 'std::pair'
template <class T1, class T2> struct pair;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:312:29: note: candidate found by name lookup is 'std::__1::pair'
struct _LIBCPP_TEMPLATE_VIS pair
^
p534.cpp:63:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
^~~~
p534.cpp:54:38: note: template is declared here
template <class T1, class T2> struct pair;
^
p534.cpp:63:37: error: expected ')'
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
^
p534.cpp:63:26: note: to match this '('
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++-7 p534.cpp -std=c++03 -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:35:0,
from p534.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.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.
#error This file requires compiler and library support \
^~~~~
p534.cpp:22:1: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~~~~
p534.cpp:28:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~
p534.cpp:22:42: error: expected initializer before 'noexcept'
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~~~~
p534.cpp:23:62: error: expected initializer before 'noexcept'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~
p534.cpp:25:51: error: expected ',' or '...' before '&&' token
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^~
p534.cpp:25:61: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^
p534.cpp:28:1: error: 'constexpr' does not name a type
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~
p534.cpp:28:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:30:1: error: 'constexpr' does not name a type
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~
p534.cpp:30:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:32:1: error: 'constexpr' does not name a type
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~
p534.cpp:32:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:34:1: error: 'constexpr' does not name a type
constexpr conditional_t<
^~~~~~~~~
p534.cpp:34:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:38:20: error: 'constexpr' does not name a type
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~
p534.cpp:38:20: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:39:41: error: expected ',' or '...' before '&&' token
template <class T> void as_const(const T&&) = delete;
^~
p534.cpp:39:47: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
template <class T> void as_const(const T&&) = delete;
^~~~~~
p534.cpp:42:1: error: 'add_rvalue_reference_t' does not name a type
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
p534.cpp:44:20: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class T, T...> struct integer_sequence;
^~~
p534.cpp:45:20: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<size_t... I>
^
p534.cpp:46:1: error: expected unqualified-id before 'using'
using index_sequence = integer_sequence<size_t, I...>;
^~~~~
p534.cpp:48:1: error: expected unqualified-id before 'using'
using make_integer_sequence = integer_sequence<T, see below >;
^~~~~
p534.cpp:50:1: error: expected unqualified-id before 'using'
using make_index_sequence = make_integer_sequence<size_t, N>;
^~~~~
p534.cpp:51:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... T>
^~~
p534.cpp:52:1: error: expected unqualified-id before 'using'
using index_sequence_for = make_index_sequence<sizeof...(T)>;
^~~~~
p534.cpp:57:1: error: 'constexpr' does not name a type
constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:57:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:59:1: error: 'constexpr' does not name a type
constexpr bool operator< (const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:59:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:61:1: error: 'constexpr' does not name a type
constexpr bool operator!=(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:61:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:63:1: error: 'constexpr' does not name a type
constexpr bool operator> (const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:63:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:65:1: error: 'constexpr' does not name a type
constexpr bool operator>=(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:65:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:67:1: error: 'constexpr' does not name a type
constexpr bool operator<=(const pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:67:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:69:45: error: expected initializer before 'noexcept'
void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
^~~~~~~~
p534.cpp:71:1: error: 'constexpr' does not name a type
constexpr see below make_pair(T1&&, T2&&);
^~~~~~~~~
p534.cpp:71:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:75:60: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
^~
> >
p534.cpp:76:66: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
^~
> >
p534.cpp:77:66: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
^~
> >
p534.cpp:79:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~
p534.cpp:79:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:82:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~
p534.cpp:82:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:85:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~
p534.cpp:85:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:88:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~
p534.cpp:88:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:91:1: error: 'constexpr' does not name a type
constexpr T& get(pair<T, U>& p) noexcept;
^~~~~~~~~
p534.cpp:91:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:93:1: error: 'constexpr' does not name a type
constexpr const T& get(const pair<T, U>& p) noexcept;
^~~~~~~~~
p534.cpp:93:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:95:1: error: 'constexpr' does not name a type
constexpr T&& get(pair<T, U>&& p) noexcept;
^~~~~~~~~
p534.cpp:95:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:97:1: error: 'constexpr' does not name a type
constexpr const T&& get(const pair<T, U>&& p) noexcept;
^~~~~~~~~
p534.cpp:97:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:99:1: error: 'constexpr' does not name a type
constexpr T& get(pair<U, T>& p) noexcept;
^~~~~~~~~
p534.cpp:99:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:101:1: error: 'constexpr' does not name a type
constexpr const T& get(const pair<U, T>& p) noexcept;
^~~~~~~~~
p534.cpp:101:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:103:1: error: 'constexpr' does not name a type
constexpr T&& get(pair<U, T>&& p) noexcept;
^~~~~~~~~
p534.cpp:103:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:105:1: error: 'constexpr' does not name a type
constexpr const T&& get(const pair<U, T>&& p) noexcept;
^~~~~~~~~
p534.cpp:105:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:108:1: error: 'constexpr' does not name a type
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~
p534.cpp:108:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:109:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types> class tuple; // defined in <tuple>
^~~
p534.cpp:112:18: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
in_place_tag() = delete;
^~~~~~
p534.cpp:114:7: error: expected nested-name-specifier before 'in_place_t'
using in_place_t = in_place_tag(&)(unspecified );
^~~~~~~~~~
p534.cpp:116:1: error: expected unqualified-id before 'using'
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^~~~~
p534.cpp:118:1: error: expected unqualified-id before 'using'
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^~~~~
p534.cpp:119:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:119:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:121:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:121:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:121:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:121:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:121:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:123:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:123:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:123:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:123:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
$ g++-7 p534.cpp -std=c++11 -Wall
p534.cpp:22:51: error: 'see' was not declared in this scope
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~
p534.cpp:22:55: error: expected ')' before 'below'
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~
p534.cpp:22:55: error: expected initializer before 'below'
p534.cpp:23:71: error: 'is_nothrow_swappable_v' was not declared in this scope
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
p534.cpp:23:71: note: suggested alternative: '__is_nothrow_swappable'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
p534.cpp:23:95: error: expected primary-expression before '>' token
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:23:96: error: expected primary-expression before ')' token
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:28:23: error: 'template<class T> constexpr T&& std::forward' conflicts with a previous declaration
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/nested_exception.h:40:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/exception:143,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/move.h:84:5: note: previous declaration 'namespace std { }::forward'
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
^~~~~~~
p534.cpp:28:23: error: 'remove_reference_t' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
p534.cpp:28:23: note: suggested alternative: 'remove_reference'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:28:43: error: expected primary-expression before '>' token
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:28:46: error: 't' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:28:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~
p534.cpp:28:49: error: expected ';' before 'noexcept'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~
p534.cpp:30:23: error: 'template<class T> constexpr T&& std::forward' conflicts with a previous declaration
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/nested_exception.h:40:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/exception:143,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/move.h:84:5: note: previous declaration 'namespace std { }::forward'
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
^~~~~~~
p534.cpp:30:23: error: 'remove_reference_t' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
p534.cpp:30:23: note: suggested alternative: 'remove_reference'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:30:43: error: expected primary-expression before '>' token
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:30:47: error: label 't' referenced outside of any function
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:30:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~
p534.cpp:30:50: error: expected ';' before 'noexcept'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~
p534.cpp:32:11: error: 'remove_reference_t' does not name a type; did you mean 'remove_reference'?
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:34:11: error: 'conditional_t' does not name a type; did you mean 'conditional'?
constexpr conditional_t<
^~~~~~~~~~~~~
conditional
p534.cpp:38:30: error: 'add_const_t' does not name a type; did you mean 'add_const'?
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~~~
add_const
p534.cpp:42:1: error: 'add_rvalue_reference_t' does not name a type; did you mean 'add_rvalue_reference'?
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
add_rvalue_reference
p534.cpp:48:51: error: 'see' was not declared in this scope
using make_integer_sequence = integer_sequence<T, see below >;
^~~
p534.cpp:48:61: error: template argument 2 is invalid
using make_integer_sequence = integer_sequence<T, see below >;
^
p534.cpp:50:29: error: 'make_integer_sequence' does not name a type; did you mean 'integer_sequence'?
using make_index_sequence = make_integer_sequence<size_t, N>;
^~~~~~~~~~~~~~~~~~~~~
integer_sequence
p534.cpp:52:28: error: 'make_index_sequence' does not name a type; did you mean 'index_sequence'?
using index_sequence_for = make_index_sequence<sizeof...(T)>;
^~~~~~~~~~~~~~~~~~~
index_sequence
p534.cpp:71:11: error: 'see' does not name a type
constexpr see below make_pair(T1&&, T2&&);
^~~
p534.cpp:79:11: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:82:11: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:85:17: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:88:17: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:107:8: error: redefinition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { };
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:76:10: note: previous definition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:108:33: error: redefinition of 'constexpr const std::piecewise_construct_t std::piecewise_construct'
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:79:53: note: 'constexpr const std::piecewise_construct_t std::piecewise_construct' previously defined here
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct =
^~~~~~~~~~~~~~~~~~~
p534.cpp:114:35: error: expected ';' before '(' token
using in_place_t = in_place_tag(&)(unspecified );
^
p534.cpp:116:40: error: expected ';' before '(' token
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^
p534.cpp:118:41: error: expected ';' before '(' token
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^
p534.cpp:119:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:119:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:121:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:121:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:121:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:121:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:121:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:123:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:123:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:123:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:123:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
$ g++-7 p534.cpp -std=c++17 -Wall
p534.cpp:22:51: error: 'see' was not declared in this scope
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~
p534.cpp:22:55: error: expected ')' before 'below'
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~
p534.cpp:22:55: error: expected initializer before 'below'
p534.cpp:48:51: error: 'see' was not declared in this scope
using make_integer_sequence = integer_sequence<T, see below >;
^~~
p534.cpp:48:61: error: template argument 2 is invalid
using make_integer_sequence = integer_sequence<T, see below >;
^
p534.cpp:50:29: error: 'make_integer_sequence' does not name a type; did you mean 'integer_sequence'?
using make_index_sequence = make_integer_sequence<size_t, N>;
^~~~~~~~~~~~~~~~~~~~~
integer_sequence
p534.cpp:52:28: error: 'make_index_sequence' does not name a type; did you mean 'index_sequence'?
using index_sequence_for = make_index_sequence<sizeof...(T)>;
^~~~~~~~~~~~~~~~~~~
index_sequence
p534.cpp:71:11: error: 'see' does not name a type
constexpr see below make_pair(T1&&, T2&&);
^~~
p534.cpp:79:11: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:82:11: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:85:17: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:88:17: error: 'tuple_element_t' does not name a type; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
tuple_element
p534.cpp:107:8: error: redefinition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { };
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:76:10: note: previous definition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:108:33: error: redefinition of 'constexpr const std::piecewise_construct_t std::piecewise_construct'
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:79:53: note: 'constexpr const std::piecewise_construct_t std::piecewise_construct' previously defined here
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct =
^~~~~~~~~~~~~~~~~~~
p534.cpp:114:35: error: expected ';' before '(' token
using in_place_t = in_place_tag(&)(unspecified );
^
p534.cpp:116:40: error: expected ';' before '(' token
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^
p534.cpp:118:41: error: expected ';' before '(' token
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^
p534.cpp:119:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:119:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:121:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:121:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:121:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:121:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:121:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:123:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:119:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:123:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:123:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:123:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
##修正
いくつかのincludeファイルを追加。いくつかの行を//に。pairをstd::pairに変更。
###算譜(source code)
// C++N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "C++N4606(241) 20.2 Utility components [utility]p534.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.
#include <iostream>
#include <cstdlib>
#include <system_error>
#include <string>
#include <type_traits>
#include <algorithm>
#include <utility>
#include <initializer_list>
namespace std {
// 20.2.1, operators:
namespace rel_ops {
template<class T> bool operator!=(const T&, const T&);
template<class T> bool operator> (const T&, const T&);
template<class T> bool operator<=(const T&, const T&);
template<class T> bool operator>=(const T&, const T&);
}
#define see
#define below true
// 20.2.2, swap:
template <class T> void swap(T& a, T& b) noexcept(see below );
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
// 20.2.3, exchange:
template <class T, class U=T> T exchange(T& obj, U&& new_val);
// 20.2.4, forward/move:
template <class T>
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
template <class T>
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
template <class T>
constexpr remove_reference_t<T>&& move(T&&) noexcept;
template <class T>
constexpr conditional_t<
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
const T&, T&&> move_if_noexcept(T& x) noexcept;
// 20.2.5, as_const:
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
template <class T> void as_const(const T&&) = delete;
// 20.2.6, declval:
template <class T>
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
// 20.3, Compile-time integer sequences
template<class T, T...> struct integer_sequence;
template<size_t... I>
//using index_sequence = integer_sequence<size_t, I...>;
template<class T, T N>
//using make_integer_sequence = integer_sequence<T, see below >;
template<size_t N>
//using make_index_sequence = make_integer_sequence<size_t, N>;
template<class... T>
//using index_sequence_for = make_index_sequence<sizeof...(T)>;
// 20.4, pairs:
template <class T1, class T2> struct std::pair;
// 20.4.3, pair specialized algorithms:
template <class T1, class T2>
constexpr bool operator==(const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator< (const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator!=(const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator> (const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator>=(const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
constexpr bool operator<=(const std::pair<T1, T2>&, const pair<T1, T2>&);
template <class T1, class T2>
void swap(pair<T1, T2>& x, std::pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
template <class T1, class T2>
//constexpr see below make_pair(T1&&, T2&&);
// 20.4.4, tuple-like access to pair:
template <class T> class tuple_size;
template <size_t I, class T> class tuple_element;
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&
get(pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&&
get(pair<T1, T2>&&) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&
get(const pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&&
get(const pair<T1, T2>&&) noexcept;
template <class T, class U>
constexpr T& get(pair<T, U>& p) noexcept;
template <class T, class U>
constexpr const T& get(const pair<T, U>& p) noexcept;
template <class T, class U>
constexpr T&& get(pair<T, U>&& p) noexcept;
template <class T, class U>
constexpr const T&& get(const pair<T, U>&& p) noexcept;
template <class T, class U>
constexpr T& get(pair<U, T>& p) noexcept;
template <class T, class U>
constexpr const T& get(const pair<U, T>& p) noexcept;
template <class T, class U>
constexpr T&& get(pair<U, T>&& p) noexcept;
template <class T, class U>
constexpr const T&& get(const pair<U, T>&& p) noexcept;
// 20.4.5, pair piecewise construction
struct piecewise_construct_t { };
constexpr piecewise_construct_t piecewise_construct{};
template <class... Types> class tuple; // defined in <tuple>
// 20.2.7, in-place construction
struct in_place_tag {
in_place_tag() = delete;
};
using in_place_t = in_place_tag(&)(unspecified );
template <class T>
using in_place_type_t = in_place_tag(&)(unspecified <T>);
template <size_t I>
using in_place_index_t = in_place_tag(&)(unspecified <I>);
in_place_tag in_place(unspecified );
template <class T>
in_place_tag in_place(unspecified <T>);
template <size_t I>
in_place_tag in_place(unspecified <I>);
}
int main() {
std::cout<< msg << std::endl;
return EXIT_SUCCESS;
}
###編纂・実行結果(compile and go)
$ ./cppall.sh p534
$ clang++ p534.cpp -std=c++03 -Wall
p534.cpp:28:41: error: expected ';' at end of declaration
template <class T> void swap(T& a, T& b) noexcept(see below );
^
;
p534.cpp:28:42: error: C++ requires a type specifier for all declarations
template <class T> void swap(T& a, T& b) noexcept(see below );
^
p534.cpp:29:61: error: expected ';' at end of declaration
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
;
p534.cpp:29:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:29:94: error: use of undeclared identifier 'T'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:29:62: error: unknown type name 'noexcept'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:29:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:29:94: error: use of undeclared identifier 'T'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:29:96: error: expected unqualified-id
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:31:51: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^
p534.cpp:31:26: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions]
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^ ~
p534.cpp:34:1: error: unknown type name 'constexpr'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:34:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:34:12: error: expected ';' at end of declaration
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
;
p534.cpp:34:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
p534.cpp:34:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:34:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:34:49: error: expected function body after function declarator
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:36:1: error: unknown type name 'constexpr'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:36:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:36:12: error: expected ';' at end of declaration
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
;
p534.cpp:36:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
p534.cpp:36:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:36:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:36:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:36:50: error: expected function body after function declarator
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
$ clang++ p534.cpp -std=c++11 -Wall
p534.cpp:29:71: error: no template named 'is_nothrow_swappable_v'; did you mean '__is_nothrow_swappable'?
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4719:8: note: '__is_nothrow_swappable' declared here
struct __is_nothrow_swappable
^
p534.cpp:29:96: error: expected '(' for function-style cast or type construction
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
~~~~~~~~~~~~~~~~~~~~~~~~~^
p534.cpp:34:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:36:23: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:38:11: error: no template named 'remove_reference_t'; did you mean 'remove_reference'?
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1104:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _Tp type;};
^
p534.cpp:40:11: error: no template named 'conditional_t'; did you mean 'conditional'?
constexpr conditional_t<
^~~~~~~~~~~~~
conditional
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:424:33: note: 'conditional' declared here
struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
^
p534.cpp:41:2: error: no template named 'is_nothrow_move_constructible_v'; did you mean 'is_nothrow_move_constructible'?
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
is_nothrow_move_constructible
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:3891:50: note: 'is_nothrow_move_constructible' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
^
p534.cpp:41:37: error: expected '(' for function-style cast or type construction
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
p534.cpp:41:40: error: no template named 'is_copy_constructible_v'; did you mean 'is_copy_constructible'?
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
^~~~~~~~~~~~~~~~~~~~~~~
is_copy_constructible
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:3399:29: note: 'is_copy_constructible' declared here
struct _LIBCPP_TEMPLATE_VIS is_copy_constructible
^
p534.cpp:41:66: error: expected '(' for function-style cast or type construction
!is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>,
~~~~~~~~~~~~~~~~~~~~~~~~~~^
p534.cpp:44:30: error: no template named 'add_const_t'; did you mean 'add_const'?
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~~~
add_const
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1069:50: note: 'add_const' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const
^
p534.cpp:48:1: error: no template named 'add_rvalue_reference_t'; did you mean 'add_rvalue_reference'?
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
add_rvalue_reference
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1131:50: note: 'add_rvalue_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
^
p534.cpp:55:17: error: declaration of 'N' shadows template parameter
template<size_t N>
^
p534.cpp:53:21: note: template parameter is declared here
template<class T, T N>
^
p534.cpp:57:19: error: declaration of 'T' shadows template parameter
template<class... T>
^
p534.cpp:53:16: note: template parameter is declared here
template<class T, T N>
^
p534.cpp:51:1: error: extraneous template parameter list in template specialization or out-of-line template definition
template<size_t... I>
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:76:1: error: extraneous template parameter list in template specialization or out-of-line template definition
template <class T1, class T2>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p534.cpp:81:31: warning: struct template 'tuple_size' was previously declared as a class template [-Wmismatched-tags]
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:25:49: note: previous use is here
template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size;
^
p534.cpp:82:38: error: explicit specialization of non-template struct 'tuple_element'
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
^ ~~~~~~~~~~~~~~~~~
p534.cpp:83:38: error: explicit specialization of non-template struct 'tuple_element'
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
^ ~~~~~~~~~~~~~~~~~
p534.cpp:85:11: error: no template named 'tuple_element_t'
constexpr tuple_element_t<I, pair<T1, T2>>&
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
$ clang++ p534.cpp -std=c++17 -Wall
p534.cpp:55:17: error: declaration of 'N' shadows template parameter
template<size_t N>
^
p534.cpp:53:21: note: template parameter is declared here
template<class T, T N>
^
p534.cpp:57:19: error: declaration of 'T' shadows template parameter
template<class... T>
^
p534.cpp:53:16: note: template parameter is declared here
template<class T, T N>
^
p534.cpp:51:1: error: extraneous template parameter list in template specialization or out-of-line template definition
template<size_t... I>
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:76:1: error: extraneous template parameter list in template specialization or out-of-line template definition
template <class T1, class T2>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p534.cpp:81:31: warning: struct template 'tuple_size' was previously declared as a class template [-Wmismatched-tags]
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:25:49: note: previous use is here
template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size;
^
p534.cpp:82:38: error: explicit specialization of non-template struct 'tuple_element'
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
^ ~~~~~~~~~~~~~~~~~
p534.cpp:83:38: error: explicit specialization of non-template struct 'tuple_element'
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
^ ~~~~~~~~~~~~~~~~~
p534.cpp:114:11: error: reference to 'piecewise_construct_t' is ambiguous
constexpr piecewise_construct_t piecewise_construct{};
^
p534.cpp:113:8: note: candidate found by name lookup is 'std::piecewise_construct_t'
struct piecewise_construct_t { };
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:295:29: note: candidate found by name lookup is 'std::__1::piecewise_construct_t'
struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { };
^
p534.cpp:120:36: error: unknown type name 'unspecified'
using in_place_t = in_place_tag(&)(unspecified );
^
p534.cpp:122:41: error: no template named 'unspecified'
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^
p534.cpp:124:42: error: no template named 'unspecified'
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^
p534.cpp:125:23: error: unknown type name 'unspecified'
in_place_tag in_place(unspecified );
^
p534.cpp:127:23: error: use of undeclared identifier 'unspecified'
in_place_tag in_place(unspecified <T>);
^
p534.cpp:127:36: error: 'T' does not refer to a value
in_place_tag in_place(unspecified <T>);
^
p534.cpp:126:17: note: declared here
template <class T>
^
p534.cpp:127:38: error: expected expression
in_place_tag in_place(unspecified <T>);
^
p534.cpp:128:18: error: template parameter has a different kind in template redeclaration
template <size_t I>
^
p534.cpp:126:17: note: previous template declaration is here
template <class T>
^
p534.cpp:129:23: error: use of undeclared identifier 'unspecified'
in_place_tag in_place(unspecified <I>);
^
p534.cpp:129:38: error: expected expression
in_place_tag in_place(unspecified <I>);
^
1 warning and 17 errors generated.
$ g++-7 p534.cpp -std=c++03 -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/system_error:35:0,
from p534.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.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.
#error This file requires compiler and library support \
^~~~~
p534.cpp:28:1: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~~~~
p534.cpp:34:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~
p534.cpp:28:42: error: expected initializer before 'noexcept'
template <class T> void swap(T& a, T& b) noexcept(see below );
^~~~~~~~
p534.cpp:29:62: error: expected initializer before 'noexcept'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~
p534.cpp:31:51: error: expected ',' or '...' before '&&' token
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^~
p534.cpp:31:61: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
template <class T, class U=T> T exchange(T& obj, U&& new_val);
^
p534.cpp:34:1: error: 'constexpr' does not name a type
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~
p534.cpp:34:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:36:1: error: 'constexpr' does not name a type
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~
p534.cpp:36:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:38:1: error: 'constexpr' does not name a type
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~
p534.cpp:38:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:40:1: error: 'constexpr' does not name a type
constexpr conditional_t<
^~~~~~~~~
p534.cpp:40:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:44:20: error: 'constexpr' does not name a type
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~
p534.cpp:44:20: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:45:41: error: expected ',' or '...' before '&&' token
template <class T> void as_const(const T&&) = delete;
^~
p534.cpp:45:47: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
template <class T> void as_const(const T&&) = delete;
^~~~~~
p534.cpp:48:1: error: 'add_rvalue_reference_t' does not name a type
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
p534.cpp:50:20: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class T, T...> struct integer_sequence;
^~~
p534.cpp:51:20: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<size_t... I>
^
p534.cpp:55:10: error: declaration of template parameter 'N' shadows template parameter
template<size_t N>
^~~~~~
p534.cpp:53:19: note: template parameter 'N' declared here
template<class T, T N>
^
p534.cpp:57:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... T>
^~~
p534.cpp:57:10: error: declaration of template parameter 'T' shadows template parameter
template<class... T>
^~~~~
p534.cpp:53:10: note: template parameter 'T' declared here
template<class T, T N>
^~~~~
p534.cpp:60:43: error: invalid use of template-name 'std::pair' without an argument list
template <class T1, class T2> struct std::pair;
^~~~
p534.cpp:60:43: note: class template argument deduction is only available with -std=c++1z or -std=gnu++1z
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: 'template<class _T1, class _T2> struct std::pair' declared here
struct pair
^~~~
p534.cpp:63:1: error: 'constexpr' does not name a type
constexpr bool operator==(const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:63:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:65:1: error: 'constexpr' does not name a type
constexpr bool operator< (const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:65:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:67:1: error: 'constexpr' does not name a type
constexpr bool operator!=(const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:67:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:69:1: error: 'constexpr' does not name a type
constexpr bool operator> (const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:69:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:71:1: error: 'constexpr' does not name a type
constexpr bool operator>=(const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:71:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:73:1: error: 'constexpr' does not name a type
constexpr bool operator<=(const std::pair<T1, T2>&, const pair<T1, T2>&);
^~~~~~~~~
p534.cpp:73:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:75:50: error: expected initializer before 'noexcept'
void swap(pair<T1, T2>& x, std::pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
^~~~~~~~
p534.cpp:79:26: error: too many template-parameter-lists
template <class T> class tuple_size;
^~~~~~~~~~
p534.cpp:81:38: error: 'tuple_size' is not a class template
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
^~~~~~~~~~
p534.cpp:81:60: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_size<pair<T1, T2>>;
^~
> >
p534.cpp:82:66: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_element<0, pair<T1, T2>>;
^~
> >
p534.cpp:83:66: error: '>>' should be '> >' within a nested template argument list
template <class T1, class T2> struct tuple_element<1, pair<T1, T2>>;
^~
> >
p534.cpp:85:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~
p534.cpp:85:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:88:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~
p534.cpp:88:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:91:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~
p534.cpp:91:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:94:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~
p534.cpp:94:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:97:1: error: 'constexpr' does not name a type
constexpr T& get(pair<T, U>& p) noexcept;
^~~~~~~~~
p534.cpp:97:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:99:1: error: 'constexpr' does not name a type
constexpr const T& get(const pair<T, U>& p) noexcept;
^~~~~~~~~
p534.cpp:99:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:101:1: error: 'constexpr' does not name a type
constexpr T&& get(pair<T, U>&& p) noexcept;
^~~~~~~~~
p534.cpp:101:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:103:1: error: 'constexpr' does not name a type
constexpr const T&& get(const pair<T, U>&& p) noexcept;
^~~~~~~~~
p534.cpp:103:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:105:1: error: 'constexpr' does not name a type
constexpr T& get(pair<U, T>& p) noexcept;
^~~~~~~~~
p534.cpp:105:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:107:1: error: 'constexpr' does not name a type
constexpr const T& get(const pair<U, T>& p) noexcept;
^~~~~~~~~
p534.cpp:107:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:109:1: error: 'constexpr' does not name a type
constexpr T&& get(pair<U, T>&& p) noexcept;
^~~~~~~~~
p534.cpp:109:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:111:1: error: 'constexpr' does not name a type
constexpr const T&& get(const pair<U, T>&& p) noexcept;
^~~~~~~~~
p534.cpp:111:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:114:1: error: 'constexpr' does not name a type
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~
p534.cpp:114:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p534.cpp:115:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types> class tuple; // defined in <tuple>
^~~
p534.cpp:118:18: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
in_place_tag() = delete;
^~~~~~
p534.cpp:120:7: error: expected nested-name-specifier before 'in_place_t'
using in_place_t = in_place_tag(&)(unspecified );
^~~~~~~~~~
p534.cpp:122:1: error: expected unqualified-id before 'using'
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^~~~~
p534.cpp:124:1: error: expected unqualified-id before 'using'
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^~~~~
p534.cpp:125:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:125:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:127:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:125:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:127:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:127:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:127:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:127:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:129:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:125:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:129:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:129:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:129:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
$ g++-7 p534.cpp -std=c++11 -Wall
p534.cpp:29:71: error: 'is_nothrow_swappable_v' was not declared in this scope
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
p534.cpp:29:71: note: suggested alternative: '__is_nothrow_swappable'
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^~~~~~~~~~~~~~~~~~~~~~
__is_nothrow_swappable
p534.cpp:29:95: error: expected primary-expression before '>' token
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:29:96: error: expected primary-expression before ')' token
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
^
p534.cpp:34:23: error: 'template<class T> constexpr T&& std::forward' conflicts with a previous declaration
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/nested_exception.h:40:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/exception:143,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/move.h:84:5: note: previous declaration 'namespace std { }::forward'
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
^~~~~~~
p534.cpp:34:23: error: 'remove_reference_t' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
p534.cpp:34:23: note: suggested alternative: 'remove_reference'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:34:43: error: expected primary-expression before '>' token
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:34:46: error: 't' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^
p534.cpp:34:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~
p534.cpp:34:49: error: expected ';' before 'noexcept'
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
^~~~~~~~
p534.cpp:36:23: error: 'template<class T> constexpr T&& std::forward' conflicts with a previous declaration
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/nested_exception.h:40:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/exception:143,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/move.h:84:5: note: previous declaration 'namespace std { }::forward'
forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
^~~~~~~
p534.cpp:36:23: error: 'remove_reference_t' was not declared in this scope
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
p534.cpp:36:23: note: suggested alternative: 'remove_reference'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:36:43: error: expected primary-expression before '>' token
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:36:47: error: label 't' referenced outside of any function
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^
p534.cpp:36:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~
p534.cpp:36:50: error: expected ';' before 'noexcept'
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
^~~~~~~~
p534.cpp:38:11: error: 'remove_reference_t' does not name a type; did you mean 'remove_reference'?
constexpr remove_reference_t<T>&& move(T&&) noexcept;
^~~~~~~~~~~~~~~~~~
remove_reference
p534.cpp:40:11: error: 'conditional_t' does not name a type; did you mean 'conditional'?
constexpr conditional_t<
^~~~~~~~~~~~~
conditional
p534.cpp:44:30: error: 'add_const_t' does not name a type; did you mean 'add_const'?
template <class T> constexpr add_const_t<T>& as_const(T& t) noexcept;
^~~~~~~~~~~
add_const
p534.cpp:48:1: error: 'add_rvalue_reference_t' does not name a type; did you mean 'add_rvalue_reference'?
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
^~~~~~~~~~~~~~~~~~~~~~
add_rvalue_reference
p534.cpp:55:10: error: declaration of template parameter 'N' shadows template parameter
template<size_t N>
^~~~~~
p534.cpp:53:19: note: template parameter 'N' declared here
template<class T, T N>
^
p534.cpp:57:10: error: declaration of template parameter 'T' shadows template parameter
template<class... T>
^~~~~
p534.cpp:53:10: note: template parameter 'T' declared here
template<class T, T N>
^~~~~
p534.cpp:60:43: error: invalid use of template-name 'std::pair' without an argument list
template <class T1, class T2> struct std::pair;
^~~~
p534.cpp:60:43: note: class template argument deduction is only available with -std=c++1z or -std=gnu++1z
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: 'template<class _T1, class _T2> struct std::pair' declared here
struct pair
^~~~
p534.cpp:79:26: error: too many template-parameter-lists
template <class T> class tuple_size;
^~~~~~~~~~
p534.cpp:85:11: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
__tuple_element_t
p534.cpp:88:11: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
__tuple_element_t
p534.cpp:91:17: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr const tuple_element_t<I, pair<T1, T2>>&
^~~~~~~~~~~~~~~
__tuple_element_t
p534.cpp:94:17: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr const tuple_element_t<I, pair<T1, T2>>&&
^~~~~~~~~~~~~~~
__tuple_element_t
p534.cpp:113:8: error: redefinition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { };
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:76:10: note: previous definition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:114:33: error: redefinition of 'constexpr const std::piecewise_construct_t std::piecewise_construct'
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:79:53: note: 'constexpr const std::piecewise_construct_t std::piecewise_construct' previously defined here
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct =
^~~~~~~~~~~~~~~~~~~
p534.cpp:120:35: error: expected ';' before '(' token
using in_place_t = in_place_tag(&)(unspecified );
^
p534.cpp:122:40: error: expected ';' before '(' token
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^
p534.cpp:124:41: error: expected ';' before '(' token
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^
p534.cpp:125:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:125:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:127:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:125:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:127:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:127:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:127:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:127:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:129:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:125:14: note: previous declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^~~~~~~~
p534.cpp:129:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:129:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:129:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
$ g++-7 p534.cpp -std=c++17 -Wall
p534.cpp:45:25: error: redefinition of 'template<class T> void std::as_const(const T&&)'
template <class T> void as_const(const T&&) = delete;
^~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/algorithm:60:0,
from p534.cpp:11:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:402:10: note: 'template<class _Tp> void std::as_const(const _Tp&&)' previously declared here
void as_const(const _Tp&&) = delete;
^~~~~~~~
p534.cpp:55:10: error: declaration of template parameter 'N' shadows template parameter
template<size_t N>
^~~~~~
p534.cpp:53:19: note: template parameter 'N' declared here
template<class T, T N>
^
p534.cpp:57:10: error: declaration of template parameter 'T' shadows template parameter
template<class... T>
^~~~~
p534.cpp:53:10: note: template parameter 'T' declared here
template<class T, T N>
^~~~~
p534.cpp:60:43: error: invalid use of template-name 'std::pair' without an argument list
template <class T1, class T2> struct std::pair;
^~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: 'template<class _T1, class _T2> struct std::pair' declared here
struct pair
^~~~
p534.cpp:79:26: error: too many template-parameter-lists
template <class T> class tuple_size;
^~~~~~~~~~
p534.cpp:113:8: error: redefinition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { };
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:76:10: note: previous definition of 'struct std::piecewise_construct_t'
struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
^~~~~~~~~~~~~~~~~~~~~
p534.cpp:114:33: error: redefinition of 'constexpr const std::piecewise_construct_t std::piecewise_construct'
constexpr piecewise_construct_t piecewise_construct{};
^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_algobase.h:64:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/char_traits.h:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:40,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
from p534.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:79:53: note: 'constexpr const std::piecewise_construct_t std::piecewise_construct' previously defined here
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct =
^~~~~~~~~~~~~~~~~~~
p534.cpp:120:35: error: expected ';' before '(' token
using in_place_t = in_place_tag(&)(unspecified );
^
p534.cpp:122:40: error: expected ';' before '(' token
using in_place_type_t = in_place_tag(&)(unspecified <T>);
^
p534.cpp:124:41: error: expected ';' before '(' token
using in_place_index_t = in_place_tag(&)(unspecified <I>);
^
p534.cpp:125:35: error: conflicting declaration 'std::in_place_tag std::in_place'
in_place_tag in_place(unspecified );
^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/algorithm:60:0,
from p534.cpp:11:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:366:31: note: previous declaration as 'constexpr const std::in_place_t std::in_place'
inline constexpr in_place_t in_place{};
^~~~~~~~
p534.cpp:125:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified );
^~~~~~~~~~~
p534.cpp:125:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified );
^~~~~~~~~~~
unexpected
p534.cpp:127:23: error: 'template<class T> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/algorithm:60:0,
from p534.cpp:11:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:366:31: note: previous declaration 'constexpr const std::in_place_t std::in_place'
inline constexpr in_place_t in_place{};
^~~~~~~~
p534.cpp:127:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
p534.cpp:127:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <T>);
^~~~~~~~~~~
unexpected
p534.cpp:127:37: error: expected primary-expression before '>' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:127:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <T>);
^
p534.cpp:129:23: error: 'template<long unsigned int I> std::in_place_tag std::in_place' redeclared as different kind of symbol
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/algorithm:60:0,
from p534.cpp:11:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:366:31: note: previous declaration 'constexpr const std::in_place_t std::in_place'
inline constexpr in_place_t in_place{};
^~~~~~~~
p534.cpp:129:23: error: 'unspecified' was not declared in this scope
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
p534.cpp:129:23: note: suggested alternative: 'unexpected'
in_place_tag in_place(unspecified <I>);
^~~~~~~~~~~
unexpected
p534.cpp:129:38: error: expected primary-expression before ')' token
in_place_tag in_place(unspecified <I>);
^
#検討事項(agenda)
コンパイルエラーの分類
役に立つまたは意味のある出力
#参考資料(reference)
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
Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d
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.10 初稿 20180430