#はじめに(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.
#(244)20.5 Tuples [tuple] 20.5.1 In general [tuple.general]p546
##算譜(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(244)20.5 Tuples [tuple] 20.5.1 In general [tuple.general]p546.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.
#include <iostream>
#include <cstdlib>
#include <cassert> // for constexpr
#include <tuple> // for allocate_arg_t
#include <string>
#include <utility>
#define EXPLICIT explicit
//20.5 Tuples [tuple]
//20.5.1 In general [tuple.general]
namespace std {
// 20.5.2, class template tuple:
//template <class... Types> class tuple;/// cause of compile error
// 20.5.2.4, tuple creation functions:
// const unspecified ignore;///
template <class... Types>
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
template <class... Types>
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
template<class... Types>
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
template <class... Tuples>
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
// 20.5.2.5, calling a function with a tuple of arguments:
template <class F, class Tuple>
constexpr decltype(auto) apply(F&& f, Tuple&& t);
template <class T, class Tuple>
constexpr T make_from_tuple(Tuple&& t);
// 20.5.2.6, tuple helper classes:
//template <class T> class tuple_size; // undefined/// cause of compile error
template <class T> class tuple_size<const T>;
template <class T> class tuple_size<volatile T>;
template <class T> class tuple_size<const volatile T>;
template <class... Types> class tuple_size<tuple<Types...>>;
//template <size_t I, class T> class tuple_element; // undefined/// cause of compile error
template <size_t I, class T> class tuple_element<I, const T>;
template <size_t I, class T> class tuple_element<I, volatile T>;
template <size_t I, class T> class tuple_element<I, const volatile T>;
template <size_t I, class... Types> class tuple_element<I, tuple<Types...>>;
template <size_t I, class T>
//using tuple_element_t = typename tuple_element<I, T>::type; /// cause of compile error
// 20.5.2.7, element access:
template <size_t I, class... Types>
constexpr tuple_element_t<I, tuple<Types...>>&
get(tuple<Types...>&) noexcept;
template <size_t I, class... Types>
constexpr tuple_element_t<I, tuple<Types...>>&&
get(tuple<Types...>&&) noexcept;
template <size_t I, class... Types>
constexpr const tuple_element_t<I, tuple<Types...>>&
get(const tuple<Types...>&) noexcept;
template <size_t I, class... Types>
constexpr const tuple_element_t<I, tuple<Types...>>&&
get(const tuple<Types...>&&) noexcept;
template <class T, class... Types>
constexpr T& get(tuple<Types...>& t) noexcept;
template <class T, class... Types>
constexpr T&& get(tuple<Types...>&& t) noexcept;
template <class T, class... Types>
constexpr const T& get(const tuple<Types...>& t) noexcept;
template <class T, class... Types>
constexpr const T&& get(const tuple<Types...>&& t) noexcept;
// 20.5.2.8, relational operators:
template<class... TTypes, class... UTypes>
constexpr bool operator==(const tuple<TTypes...>&, const tuple<UTypes...>&);
template<class... TTypes, class... UTypes>
constexpr bool operator<(const tuple<TTypes...>&, const tuple<UTypes...>&);
template<class... TTypes, class... UTypes>
constexpr bool operator!=(const tuple<TTypes...>&, const tuple<UTypes...>&);
template<class... TTypes, class... UTypes>
constexpr bool operator>(const tuple<TTypes...>&, const tuple<UTypes...>&);
template<class... TTypes, class... UTypes>
constexpr bool operator<=(const tuple<TTypes...>&, const tuple<UTypes...>&);
template<class... TTypes, class... UTypes>
constexpr bool operator>=(const tuple<TTypes...>&, const tuple<UTypes...>&);
// 20.5.2.9, allocator-related traits
template <class... Types, class Alloc>
struct uses_allocator<tuple<Types...>, Alloc>;
// 20.5.2.10, specialized algorithms:
//template <class... Types>
//void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(see below );
// 20.5.2.6, tuple helper classes
template <class T> constexpr size_t tuple_size_v
= tuple_size<T>::value;
}
//20.5.2 Class template tuple [tuple.tuple]
namespace std {
template <class... Types>
class tuple {
public:
// 20.5.2.1, tuple construction
constexpr tuple();
EXPLICIT constexpr tuple(const Types&...); // only if sizeof...(Types) >= 1
template <class... UTypes>
EXPLICIT constexpr tuple(UTypes&&...); // only if sizeof...(Types) >= 1
tuple(const tuple&) = default;
tuple(tuple&&) = default;
template <class... UTypes>
EXPLICIT constexpr tuple(const tuple<UTypes...>&);
template <class... UTypes>
EXPLICIT constexpr tuple(tuple<UTypes...>&&);
template <class U1, class U2>
EXPLICIT constexpr tuple(const pair<U1, U2>&); // only if sizeof...(Types) == 2
template <class U1, class U2>
EXPLICIT constexpr tuple(pair<U1, U2>&&); // only if sizeof...(Types) == 2
// allocator-extended constructors
template <class Alloc>
tuple(allocator_arg_t, const Alloc& a);
template <class Alloc>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const Types&...);
template <class Alloc, class... UTypes>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
template <class Alloc>
tuple(allocator_arg_t, const Alloc& a, const tuple&);
template <class Alloc>
tuple(allocator_arg_t, const Alloc& a, tuple&&);
template <class Alloc, class... UTypes>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
template <class Alloc, class... UTypes>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
template <class Alloc, class U1, class U2>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
template <class Alloc, class U1, class U2>
EXPLICIT tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
// 20.5.2.2, tuple assignment
tuple& operator=(const tuple&);
//tuple& operator=(tuple&&) noexcept(see below );
template <class... UTypes>
tuple& operator=(const tuple<UTypes...>&);
template <class... UTypes>
tuple& operator=(tuple<UTypes...>&&);
template <class U1, class U2>
tuple& operator=(const pair<U1, U2>&); // only if sizeof...(Types) == 2
template <class U1, class U2>
tuple& operator=(pair<U1, U2>&&); // only if sizeof...(Types) == 2
// 20.5.2.3, tuple swap
//void swap(tuple&) noexcept(see below );
};
}
int main() {
std::cout<< msg << std::endl;
return EXIT_SUCCESS;
}
##編纂・実行結果(compile and go)
$ ./cppall.sh p546
$ clang++ p546.cpp -std=c++03 -Wall
p546.cpp:22:16: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <class... Types>
^
p546.cpp:23:1: error: unknown type name 'constexpr'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:23:16: warning: extra qualification on member 'tuple' [-Wextra-qualification]
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:23:16: warning: variable templates are a C++14 extension [-Wc++14-extensions]
p546.cpp:23:16: error: no member named 'tuple' in namespace 'std'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
~~~~~^
p546.cpp:23:21: error: expected ';' at end of declaration
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
;
p546.cpp:23:21: error: expected unqualified-id
p546.cpp:24:16: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <class... Types>
^
p546.cpp:25:1: error: unknown type name 'constexpr'
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:25:27: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:25:16: warning: extra qualification on member 'tuple' [-Wextra-qualification]
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:25:33: error: expected ';' at end of declaration
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
;
p546.cpp:25:51: error: unknown type name 'Types'
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:25:56: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:25:63: error: expected function body after function declarator
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^
p546.cpp:26:15: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template<class... Types>
^
p546.cpp:27:1: error: unknown type name 'constexpr'
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^
p546.cpp:27:16: warning: extra qualification on member 'tuple' [-Wextra-qualification]
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^
p546.cpp:27:32: error: expected ';' at end of declaration
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^
;
p546.cpp:27:37: error: unknown type name 'Types'
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^
p546.cpp:27:48: error: expected function body after function declarator
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^
p546.cpp:28:16: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <class... Tuples>
^
p546.cpp:29:1: error: unknown type name 'constexpr'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:22: error: no template named 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:29: error: pack expansion does not contain any unexpanded parameter packs
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
~~~~~~ ^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:29:50: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:29:34: warning: extra qualification on member 'tuple_cat' [-Wextra-qualification]
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:32:1: error: unknown type name 'constexpr'
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^
p546.cpp:32:20: warning: 'decltype(auto)' type specifier is a C++14 extension [-Wc++14-extensions]
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^
p546.cpp:32:11: error: expected unqualified-id
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__config:821:25: note: expanded from macro 'decltype'
# define decltype(__x) __decltype(__x)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
13 warnings and 20 errors generated.
$ clang++ p546.cpp -std=c++11 -Wall
p546.cpp:23:22: error: use of undeclared identifier 'VTypes'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:22: error: no template named 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:29: error: pack expansion does not contain any unexpanded parameter packs
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
~~~~~~ ^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:32:20: warning: 'decltype(auto)' type specifier is a C++14 extension [-Wc++14-extensions]
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^
p546.cpp:32:11: error: deduced return types are a C++14 extension
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^
p546.cpp:49:18: error: declaration of 'I' shadows template parameter
template <size_t I, class... Types>
^
p546.cpp:46:18: note: template parameter is declared here
template <size_t I, class T>
^
p546.cpp:50:11: error: no template named 'tuple_element_t'; did you mean 'tuple_element'?
constexpr tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~~~~~~~
tuple_element
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:57:61: note: 'tuple_element' declared here
template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
^
p546.cpp:50:27: error: reference to 'I' is ambiguous
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:49:18: note: candidate found by name lookup is 'I'
template <size_t I, class... Types>
^
p546.cpp:46:18: note: candidate found by name lookup is 'I'
template <size_t I, class T>
^
p546.cpp:50:27: error: unknown type name 'I'
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:50:1: error: constexpr can only be used in variable and function declarations
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:53:11: error: no template named 'tuple_element_t'; did you mean 'tuple_element'?
constexpr tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~~~~~~~
tuple_element
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:57:61: note: 'tuple_element' declared here
template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
^
p546.cpp:56:17: error: no template named 'tuple_element_t'; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~~~~~~~
tuple_element
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:57:61: note: 'tuple_element' declared here
template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
^
p546.cpp:59:17: error: no template named 'tuple_element_t'; did you mean 'tuple_element'?
constexpr const tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~~~~~~~
tuple_element
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:57:61: note: 'tuple_element' declared here
template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
^
p546.cpp:89:37: warning: variable templates are a C++14 extension [-Wc++14-extensions]
template <class T> constexpr size_t tuple_size_v
^
2 warnings and 14 errors generated.
$ clang++ p546.cpp -std=c++17 -Wall
p546.cpp:23:22: error: use of undeclared identifier 'VTypes'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:22: error: no template named 'Ctypes'; did you mean 'ctype'?
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:479:52: note: 'ctype' declared here
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
^
p546.cpp:29:29: error: pack expansion does not contain any unexpanded parameter packs
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
~~~~~~ ^
p546.cpp:29:22: error: use of undeclared identifier 'Ctypes'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:49:18: error: declaration of 'I' shadows template parameter
template <size_t I, class... Types>
^
p546.cpp:46:18: note: template parameter is declared here
template <size_t I, class T>
^
p546.cpp:50:27: error: reference to 'I' is ambiguous
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:49:18: note: candidate found by name lookup is 'I'
template <size_t I, class... Types>
^
p546.cpp:46:18: note: candidate found by name lookup is 'I'
template <size_t I, class T>
^
p546.cpp:50:27: error: unknown type name 'I'
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:50:1: error: constexpr can only be used in variable and function declarations
constexpr tuple_element_t<I, tuple<Types...>>&
^
9 errors generated.
$ g++-7 p546.cpp -std=c++03 -Wall
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:35:0,
from p546.cpp:9:
/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 \
^~~~~
p546.cpp:23:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~~~~
p546.cpp:25:1: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^~~~~~~~~
p546.cpp:32:1: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^~~~~~~~~
p546.cpp:22:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types>
^~~
p546.cpp:23:1: error: 'constexpr' does not name a type
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~~~~
p546.cpp:23:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:24:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types>
^~~
p546.cpp:25:1: error: 'constexpr' does not name a type
constexpr std::tuple<Types&&...> forward_as_tuple(Types&&...) noexcept;
^~~~~~~~~
p546.cpp:25:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:26:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... Types>
^~~
p546.cpp:27:1: error: 'constexpr' does not name a type
constexpr std::tuple<Types&...> tie(Types&...) noexcept;
^~~~~~~~~
p546.cpp:27:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:28:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Tuples>
^~~
p546.cpp:29:1: error: 'constexpr' does not name a type
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~~~~
p546.cpp:29:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:32:1: error: 'constexpr' does not name a type
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^~~~~~~~~
p546.cpp:32:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:34:1: error: 'constexpr' does not name a type
constexpr T make_from_tuple(Tuple&& t);
^~~~~~~~~
p546.cpp:34:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:37:26: error: 'tuple_size' is not a class template
template <class T> class tuple_size<const T>;
^~~~~~~~~~
p546.cpp:40:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types> class tuple_size<tuple<Types...>>;
^~~
p546.cpp:40:44: error: 'tuple' was not declared in this scope
template <class... Types> class tuple_size<tuple<Types...>>;
^~~~~
p546.cpp:40:55: error: expected parameter pack before '...'
template <class... Types> class tuple_size<tuple<Types...>>;
^~~
p546.cpp:40:58: error: spurious '>>', use '>' to terminate a template argument list
template <class... Types> class tuple_size<tuple<Types...>>;
^~
p546.cpp:40:58: error: template argument 1 is invalid
p546.cpp:42:36: error: 'tuple_element' is not a class template
template <size_t I, class T> class tuple_element<I, const T>;
^~~~~~~~~~~~~
p546.cpp:45:26: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <size_t I, class... Types> class tuple_element<I, tuple<Types...>>;
^~~
p546.cpp:45:60: error: 'tuple' was not declared in this scope
template <size_t I, class... Types> class tuple_element<I, tuple<Types...>>;
^~~~~
p546.cpp:45:71: error: expected parameter pack before '...'
template <size_t I, class... Types> class tuple_element<I, tuple<Types...>>;
^~~
p546.cpp:45:74: error: spurious '>>', use '>' to terminate a template argument list
template <size_t I, class... Types> class tuple_element<I, tuple<Types...>>;
^~
p546.cpp:45:74: error: template argument 2 is invalid
p546.cpp:49:11: error: declaration of template parameter 'I' shadows template parameter
template <size_t I, class... Types>
^~~~~~
p546.cpp:46:11: note: template parameter 'I' declared here
template <size_t I, class T>
^~~~~~
p546.cpp:49:26: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <size_t I, class... Types>
^~~
p546.cpp:50:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~
p546.cpp:50:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:52:26: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <size_t I, class... Types>
^~~
p546.cpp:53:1: error: 'constexpr' does not name a type
constexpr tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~
p546.cpp:53:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:55:26: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <size_t I, class... Types>
^~~
p546.cpp:56:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~
p546.cpp:56:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:58:26: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <size_t I, class... Types>
^~~
p546.cpp:59:1: error: 'constexpr' does not name a type
constexpr const tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~
p546.cpp:59:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:61:25: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class T, class... Types>
^~~
p546.cpp:62:1: error: 'constexpr' does not name a type
constexpr T& get(tuple<Types...>& t) noexcept;
^~~~~~~~~
p546.cpp:62:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:63:25: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class T, class... Types>
^~~
p546.cpp:64:1: error: 'constexpr' does not name a type
constexpr T&& get(tuple<Types...>&& t) noexcept;
^~~~~~~~~
p546.cpp:64:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:65:25: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class T, class... Types>
^~~
p546.cpp:66:1: error: 'constexpr' does not name a type
constexpr const T& get(const tuple<Types...>& t) noexcept;
^~~~~~~~~
p546.cpp:66:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:67:25: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class T, class... Types>
^~~
p546.cpp:68:1: error: 'constexpr' does not name a type
constexpr const T&& get(const tuple<Types...>&& t) noexcept;
^~~~~~~~~
p546.cpp:68:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:70:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:70:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:71:1: error: 'constexpr' does not name a type
constexpr bool operator==(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:71:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:72:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:72:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:73:1: error: 'constexpr' does not name a type
constexpr bool operator<(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:73:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:74:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:74:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:75:1: error: 'constexpr' does not name a type
constexpr bool operator!=(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:75:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:76:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:76:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:77:1: error: 'constexpr' does not name a type
constexpr bool operator>(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:77:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:78:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:78:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:79:1: error: 'constexpr' does not name a type
constexpr bool operator<=(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:79:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:80:15: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:80:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<class... TTypes, class... UTypes>
^~~
p546.cpp:81:1: error: 'constexpr' does not name a type
constexpr bool operator>=(const tuple<TTypes...>&, const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:81:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:83:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types, class Alloc>
^~~
p546.cpp:84:23: error: 'tuple' was not declared in this scope
struct uses_allocator<tuple<Types...>, Alloc>;
^~~~~
p546.cpp:84:34: error: expected parameter pack before '...'
struct uses_allocator<tuple<Types...>, Alloc>;
^~~
p546.cpp:84:37: error: wrong number of template arguments (1, should be 2)
struct uses_allocator<tuple<Types...>, Alloc>;
^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stringfwd.h:40:0,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iosfwd:39,
from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:38,
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 p546.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/memoryfwd.h:71:12: note: provided for 'template<class, class> struct std::uses_allocator'
struct uses_allocator;
^~~~~~~~~~~~~~
p546.cpp:89:20: error: 'constexpr' does not name a type
template <class T> constexpr size_t tuple_size_v
^~~~~~~~~
p546.cpp:89:20: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:94:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... Types>
^~~
p546.cpp:98:1: error: 'constexpr' does not name a type
constexpr tuple();
^~~~~~~~~
p546.cpp:98:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:99:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(const Types&...); // only if sizeof...(Types) >= 1
^~~~~~~~~
p546.cpp:99:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:100:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... UTypes>
^~~
p546.cpp:101:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(UTypes&&...); // only if sizeof...(Types) >= 1
^~~~~~~~~
p546.cpp:101:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:102:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
tuple(const tuple&) = default;
^~~~~~~
p546.cpp:103:12: error: expected ',' or '...' before '&&' token
tuple(tuple&&) = default;
^~
p546.cpp:103:18: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
tuple(tuple&&) = default;
^~~~~~~
p546.cpp:103:18: error: invalid constructor; you probably meant 'std::tuple<Types> (const std::tuple<Types>&)'
p546.cpp:104:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... UTypes>
^~~
p546.cpp:105:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(const tuple<UTypes...>&);
^~~~~~~~~
p546.cpp:105:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:106:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... UTypes>
^~~
p546.cpp:107:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(tuple<UTypes...>&&);
^~~~~~~~~
p546.cpp:107:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:109:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(const pair<U1, U2>&); // only if sizeof...(Types) == 2
^~~~~~~~~
p546.cpp:109:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:111:10: error: 'constexpr' does not name a type
EXPLICIT constexpr tuple(pair<U1, U2>&&); // only if sizeof...(Types) == 2
^~~~~~~~~
p546.cpp:111:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p546.cpp:114:22: error: expected ')' before ',' token
tuple(allocator_arg_t, const Alloc& a);
^
p546.cpp:116:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const Types&...);
^
p546.cpp:117:29: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class Alloc, class... UTypes>
^~~
p546.cpp:118:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
^
p546.cpp:120:22: error: expected ')' before ',' token
tuple(allocator_arg_t, const Alloc& a, const tuple&);
^
p546.cpp:122:22: error: expected ')' before ',' token
tuple(allocator_arg_t, const Alloc& a, tuple&&);
^
p546.cpp:123:29: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class Alloc, class... UTypes>
^~~
p546.cpp:124:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
^
p546.cpp:125:29: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class Alloc, class... UTypes>
^~~
p546.cpp:126:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
^
p546.cpp:128:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
^
p546.cpp:130:31: error: expected ')' before ',' token
EXPLICIT tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
^
p546.cpp:134:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... UTypes>
^~~
p546.cpp:136:16: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template <class... UTypes>
^~~
p546.cpp:137:34: error: expected ',' or '...' before '&&' token
tuple& operator=(tuple<UTypes...>&&);
^~
p546.cpp:141:30: error: expected ',' or '...' before '&&' token
tuple& operator=(pair<U1, U2>&&); // only if sizeof...(Types) == 2
^~
$ g++-7 p546.cpp -std=c++11 -Wall
p546.cpp:23:22: error: 'VTypes' was not declared in this scope
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~
p546.cpp:23:22: note: suggested alternative: 'Types'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~
Types
p546.cpp:23:29: error: expected parameter pack before '...'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~
p546.cpp:23:32: error: template argument 1 is invalid
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:29:22: error: 'Ctypes' was not declared in this scope
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
p546.cpp:29:22: note: suggested alternative: 'ctype'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
p546.cpp:29:29: error: expected parameter pack before '...'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~
p546.cpp:29:32: error: template argument 1 is invalid
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:32:20: error: expected primary-expression before 'auto'
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^~~~
p546.cpp:32:20: error: expected ')' before 'auto'
p546.cpp:32:11: error: expected unqualified-id before 'decltype'
constexpr decltype(auto) apply(F&& f, Tuple&& t);
^~~~~~~~
p546.cpp:49:11: error: declaration of template parameter 'I' shadows template parameter
template <size_t I, class... Types>
^~~~~~
p546.cpp:46:11: note: template parameter 'I' declared here
template <size_t I, class T>
^~~~~~
p546.cpp:50:11: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~~~~~~~
__tuple_element_t
p546.cpp:53:11: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~~~~~~~
__tuple_element_t
p546.cpp:56:17: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr const tuple_element_t<I, tuple<Types...>>&
^~~~~~~~~~~~~~~
__tuple_element_t
p546.cpp:59:17: error: 'tuple_element_t' does not name a type; did you mean '__tuple_element_t'?
constexpr const tuple_element_t<I, tuple<Types...>>&&
^~~~~~~~~~~~~~~
__tuple_element_t
p546.cpp:89:37: warning: variable templates only available with -std=c++14 or -std=gnu++14
template <class T> constexpr size_t tuple_size_v
^~~~~~~~~~~~
p546.cpp:95:7: error: redefinition of 'class std::tuple<_Elements>'
class tuple {
^~~~~
In file included from p546.cpp:9:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:556:11: note: previous definition of 'class std::tuple<_Elements>'
class tuple : public _Tuple_impl<0, _Elements...>
^~~~~
$ g++-7 p546.cpp -std=c++17 -Wall
p546.cpp:23:22: error: 'VTypes' was not declared in this scope
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~
p546.cpp:23:22: note: suggested alternative: 'Types'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~~~~
Types
p546.cpp:23:29: error: expected parameter pack before '...'
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^~~
p546.cpp:23:32: error: template argument 1 is invalid
constexpr std::tuple<VTypes ...> make_tuple(Types&&...);/// from clang++ warning
^
p546.cpp:29:22: error: 'Ctypes' was not declared in this scope
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
p546.cpp:29:22: note: suggested alternative: 'ctype'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~~~~
ctype
p546.cpp:29:29: error: expected parameter pack before '...'
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^~~
p546.cpp:29:32: error: template argument 1 is invalid
constexpr std::tuple<Ctypes ...> tuple_cat(Tuples&&...);
^
p546.cpp:49:11: error: declaration of template parameter 'I' shadows template parameter
template <size_t I, class... Types>
^~~~~~
p546.cpp:46:11: note: template parameter 'I' declared here
template <size_t I, class T>
^~~~~~
p546.cpp:50:46: error: too many template-parameter-lists
constexpr tuple_element_t<I, tuple<Types...>>&
^
p546.cpp:95:7: error: redefinition of 'class std::tuple<_Elements>'
class tuple {
^~~~~
In file included from p546.cpp:9:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:556:11: note: previous definition of 'class std::tuple<_Elements>'
class tuple : public _Tuple_impl<0, _Elements...>
^~~~~
#検討事項(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
C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff
Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d
cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67
MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74
C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed
ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1
C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a
C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9
'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11
Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc
MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb
どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00
MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671
#文書履歴(document history)
ver. 0.10 初稿 20180430