LoginSignup
1
0

More than 5 years have passed since last update.

C++N4606(243)20.4 Pairs [pairs]p541

Last updated at Posted at 2018-04-30

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

(243)20.4 Pairs [pairs]p541

算譜(source code)

p541.cpp
// 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(243)20.4 Pairs [pairs]p541.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>

//20.4 Pairs [pairs]
//20.4.2 Class template pair [pairs.pair]
// defined in header <utility>
namespace std {
template <class T1, class T2>
struct pair {
using first_type = T1;
using second_type = T2;
T1 first;
T2 second;
pair(const pair&) = default;
pair(pair&&) = default;
constexpr pair();
EXPLICIT constexpr pair(const T1& x, const T2& y);
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
template<class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
template<class U, class V> EXPLICIT constexpr pair(pair<U, V>&& p);
template <class... Args1, class... Args2>
pair(piecewise_construct_t,
tuple<Args1...> first_args, tuple<Args2...> second_args);
pair& operator=(const pair& p);
template<class U, class V> pair& operator=(const pair<U, V>& p);
pair& operator=(pair&& p) noexcept(see below );
template<class U, class V> pair& operator=(pair<U, V>&& p);
void swap(pair& p) noexcept(see below );
};
}

//20.4.3 Specialized algorithms [pairs.spec]
template <class T1, class T2>
constexpr bool operator==(const pair<T1, T2>& x, const pair<T1, T2>& y);

constexpr bool operator<(const pair<T1, T2>& x, const pair<T1, T2>& y);

template <class T1, class T2>
constexpr bool operator!=(const pair<T1, T2>& x, const pair<T1, T2>& y);

template <class T1, class T2>
constexpr bool operator>(const pair<T1, T2>& x, const pair<T1, T2>& y);

template <class T1, class T2>
constexpr bool operator>=(const pair<T1, T2>& x, const pair<T1, T2>& y);

template <class T1, class T2>
constexpr bool operator<=(const pair<T1, T2>& x, const pair<T1, T2>& y);

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 pair<V1, V2> make_pair(T1&& x, T2&& y);

return pair<int, double>(5, 3.1415926); // explicit types
a C++ program may contain:
return make_pair(5, 3.1415926); // types are deduced

//20.4.4 Tuple-like access to pair [pair.astuple]
template <class T1, class T2>
struct tuple_size<pair<T1, T2>>
: integral_constant<size_t, 2> { };
tuple_element<0, pair<T1, T2>>::type

tuple_element<1, pair<T1, T2>>::type

template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&
get(pair<T1, T2>& p) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&
get(const pair<T1, T2>& p) noexcept;
template<size_t I, class T1, class T2>
constexpr tuple_element_t<I, pair<T1, T2>>&&
get(pair<T1, T2>&& p) noexcept;
template<size_t I, class T1, class T2>
constexpr const tuple_element_t<I, pair<T1, T2>>&&
get(const pair<T1, T2>&& 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<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;

int main() {
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

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

cppall.sh
$ ./cppall.sh p541
$ clang++ p541.cpp -std=c++03 -Wall
p541.cpp:21:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using first_type = T1;
                   ^
p541.cpp:22:21: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using second_type = T2;
                    ^
p541.cpp:25:21: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
pair(const pair&) = default;
                    ^
p541.cpp:26:10: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
pair(pair&&) = default;
         ^
p541.cpp:26:16: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
pair(pair&&) = default;
               ^
p541.cpp:27:1: error: unknown type name 'constexpr'
constexpr pair();
^
p541.cpp:27:11: error: constructor cannot have a return type
constexpr pair();
          ^~~~
p541.cpp:28:10: error: unknown type name 'constexpr'
EXPLICIT constexpr pair(const T1& x, const T2& y);
         ^
p541.cpp:28:20: error: constructor cannot have a return type
EXPLICIT constexpr pair(const T1& x, const T2& y);
                   ^~~~
p541.cpp:29:37: error: unknown type name 'constexpr'
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
                                    ^
p541.cpp:29:53: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
                                                    ^
p541.cpp:29:60: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
                                                           ^
p541.cpp:29:47: error: constructor cannot have a return type
template<class U, class V> EXPLICIT constexpr pair(U&& x, V&& y);
                                              ^~~~
p541.cpp:30:37: error: unknown type name 'constexpr'
template<class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
                                    ^
p541.cpp:30:47: error: constructor cannot have a return type
template<class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
                                              ^~~~
p541.cpp:31:37: error: unknown type name 'constexpr'
template<class U, class V> EXPLICIT constexpr pair(pair<U, V>&& p);
                                    ^
p541.cpp:31:62: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template<class U, class V> EXPLICIT constexpr pair(pair<U, V>&& p);
                                                             ^
p541.cpp:31:47: error: constructor cannot have a return type
template<class U, class V> EXPLICIT constexpr pair(pair<U, V>&& p);
                                              ^~~~
p541.cpp:32:16: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <class... Args1, class... Args2>
               ^
p541.cpp:32:32: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template <class... Args1, class... Args2>
                               ^
p541.cpp:34:1: error: no template named 'tuple'
tuple<Args1...> first_args, tuple<Args2...> second_args);
^
p541.cpp:34:29: error: no template named 'tuple'
tuple<Args1...> first_args, tuple<Args2...> second_args);
                            ^
p541.cpp:37:21: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
pair& operator=(pair&& p) noexcept(see below );
                    ^
p541.cpp:37:26: error: expected ';' at end of declaration list
pair& operator=(pair&& p) noexcept(see below );
                         ^
                         ;
p541.cpp:38:54: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
template<class U, class V> pair& operator=(pair<U, V>&& p);
                                                     ^
p541.cpp:39:19: error: expected ';' at end of declaration list
void swap(pair& p) noexcept(see below );
                  ^
                  ;
p541.cpp:45:1: error: unknown type name 'constexpr'
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
^
p541.cpp:45:11: error: expected unqualified-id
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
          ^
p541.cpp:47:1: error: unknown type name 'constexpr'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
^
p541.cpp:47:11: error: expected unqualified-id
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
          ^
p541.cpp:50:1: error: unknown type name 'constexpr'
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
$ clang++ p541.cpp -std=c++11 -Wall
p541.cpp:37:46: error: expected expression
pair& operator=(pair&& p) noexcept(see below );
                                             ^
p541.cpp:39:39: error: expected expression
void swap(pair& p) noexcept(see below );
                                      ^
p541.cpp:45:38: error: no template named 'pair' in namespace 'std'
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ~~~~~^
p541.cpp:45:66: error: no template named 'pair' in namespace 'std'
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                            ~~~~~^
p541.cpp:47:37: error: no template named 'pair' in namespace 'std'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                               ~~~~~^
p541.cpp:47:42: error: use of undeclared identifier 'T1'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                         ^
p541.cpp:47:65: error: no template named 'pair' in namespace 'std'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                           ~~~~~^
p541.cpp:47:70: error: use of undeclared identifier 'T1'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                     ^
p541.cpp:50:38: error: no template named 'pair' in namespace 'std'
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ~~~~~^
p541.cpp:50:66: error: no template named 'pair' in namespace 'std'
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                            ~~~~~^
p541.cpp:53:37: error: no template named 'pair' in namespace 'std'
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                               ~~~~~^
p541.cpp:53:65: error: no template named 'pair' in namespace 'std'
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                           ~~~~~^
p541.cpp:56:38: error: no template named 'pair' in namespace 'std'
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ~~~~~^
p541.cpp:56:66: error: no template named 'pair' in namespace 'std'
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                            ~~~~~^
p541.cpp:59:38: error: no template named 'pair' in namespace 'std'
constexpr bool operator<=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ~~~~~^
p541.cpp:59:66: error: no template named 'pair' in namespace 'std'
constexpr bool operator<=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                            ~~~~~^
p541.cpp:61:45: error: reference to 'pair' is ambiguous
template<class T1, class T2> void swap(std::pair<T1, T2>& x, std::pair<T1, T2>& y)
                                       ~~~~~^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:61:45: error: no template named 'pair' in namespace 'std'
template<class T1, class T2> void swap(std::pair<T1, T2>& x, std::pair<T1, T2>& y)
                                       ~~~~~^
p541.cpp:61:67: error: no template named 'pair' in namespace 'std'
template<class T1, class T2> void swap(std::pair<T1, T2>& x, std::pair<T1, T2>& y)
                                                             ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p541.cpp -std=c++17 -Wall
p541.cpp:37:46: error: expected expression
pair& operator=(pair&& p) noexcept(see below );
                                             ^
p541.cpp:39:39: error: expected expression
void swap(pair& p) noexcept(see below );
                                      ^
p541.cpp:45:38: error: reference to 'pair' is ambiguous
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                     ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:45:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
p541.cpp:45:42: error: expected ')'
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                         ^
p541.cpp:45:26: note: to match this '('
constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                         ^
p541.cpp:47:37: error: reference to 'pair' is ambiguous
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                    ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:47:32: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                               ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
p541.cpp:47:41: error: expected ')'
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                        ^
p541.cpp:47:25: note: to match this '('
constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                        ^
p541.cpp:50:38: error: reference to 'pair' is ambiguous
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                     ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:50:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
p541.cpp:50:42: error: expected ')'
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                         ^
p541.cpp:50:26: note: to match this '('
constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                         ^
p541.cpp:53:37: error: reference to 'pair' is ambiguous
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                    ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:53:32: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                               ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
p541.cpp:53:41: error: expected ')'
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                        ^
p541.cpp:53:25: note: to match this '('
constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                        ^
p541.cpp:56:38: error: reference to 'pair' is ambiguous
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                     ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:56:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
p541.cpp:56:42: error: expected ')'
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                         ^
p541.cpp:56:26: note: to match this '('
constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                         ^
p541.cpp:59:38: error: reference to 'pair' is ambiguous
constexpr bool operator<=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                     ^
/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
                            ^
p541.cpp:20:8: note: candidate found by name lookup is 'std::pair'
struct pair {
       ^
p541.cpp:59:33: error: use of class template 'pair' requires template arguments; argument deduction not allowed in function prototype
constexpr bool operator<=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                ^~~
p541.cpp:20:8: note: template is declared here
struct pair {
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++-7 p541.cpp -std=c++03  -Wall
p541.cpp:27:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
 constexpr pair();
 ^~~~~~~~~
p541.cpp:37:1: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
 pair& operator=(pair&& p) noexcept(see below );
 ^~~~
p541.cpp:20:8: error: redefinition of 'struct std::pair<_T1, _T2>'
 struct 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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: previous definition of 'struct std::pair<_T1, _T2>'
     struct pair
            ^~~~
p541.cpp:45:1: error: 'constexpr' does not name a type
 constexpr bool operator==(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:45:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:47:1: error: 'constexpr' does not name a type
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:47:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:50:1: error: 'constexpr' does not name a type
 constexpr bool operator!=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:50:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:53:1: error: 'constexpr' does not name a type
 constexpr bool operator>(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:53:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:56:1: error: 'constexpr' does not name a type
 constexpr bool operator>=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:56:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:59:1: error: 'constexpr' does not name a type
 constexpr bool operator<=(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
 ^~~~~~~~~
p541.cpp:59:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:62:1: error: expected initializer before 'noexcept'
 noexcept(noexcept(x.swap(y)));
 ^~~~~~~~
p541.cpp:66:1: error: 'constexpr' does not name a type
 constexpr pair<V1, V2> make_pair(T1&& x, T2&& y);
 ^~~~~~~~~
p541.cpp:66:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:69:1: error: 'a' does not name a type
 a C++ program may contain:
 ^
p541.cpp:76:1: error: 'tuple_element' does not name a type
 tuple_element<0, pair<T1, T2>>::type
 ^~~~~~~~~~~~~
p541.cpp:84:1: error: 'constexpr' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&
 ^~~~~~~~~
p541.cpp:84:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:87:1: error: 'constexpr' does not name a type
 constexpr tuple_element_t<I, pair<T1, T2>>&&
 ^~~~~~~~~
p541.cpp:87:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:90:1: error: 'constexpr' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&&
 ^~~~~~~~~
p541.cpp:90:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:94:1: error: 'constexpr' does not name a type
 constexpr T& get(pair<T, U>& p) noexcept;
 ^~~~~~~~~
p541.cpp:94:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:96:1: error: 'constexpr' does not name a type
 constexpr const T& get(const pair<T, U>& p) noexcept;
 ^~~~~~~~~
p541.cpp:96:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:98:1: error: 'constexpr' does not name a type
 constexpr T&& get(pair<T, U>&& p) noexcept;
 ^~~~~~~~~
p541.cpp:98:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:100:1: error: 'constexpr' does not name a type
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
 ^~~~~~~~~
p541.cpp:100:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:103:1: error: 'constexpr' does not name a type
 constexpr T& get(pair<U, T>& p) noexcept;
 ^~~~~~~~~
p541.cpp:103:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:105:1: error: 'constexpr' does not name a type
 constexpr const T& get(const pair<U, T>& p) noexcept;
 ^~~~~~~~~
p541.cpp:105:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:107:1: error: 'constexpr' does not name a type
 constexpr T&& get(pair<U, T>&& p) noexcept;
 ^~~~~~~~~
p541.cpp:107:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
p541.cpp:109:1: error: 'constexpr' does not name a type
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
 ^~~~~~~~~
p541.cpp:109:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11

$ g++-7 p541.cpp -std=c++11  -Wall
p541.cpp:20:8: error: redefinition of 'struct std::pair<_T1, _T2>'
 struct 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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: previous definition of 'struct std::pair<_T1, _T2>'
     struct pair
            ^~~~
p541.cpp:47:42: error: 'T1' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                          ^~
p541.cpp:47:46: error: 'T2' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                              ^~
p541.cpp:47:48: error: template argument 1 is invalid
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                ^
p541.cpp:47:48: error: template argument 2 is invalid
p541.cpp:47:70: error: 'T1' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                      ^~
p541.cpp:47:74: error: 'T2' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                          ^~
p541.cpp:47:76: error: template argument 1 is invalid
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                            ^
p541.cpp:47:76: error: template argument 2 is invalid
p541.cpp:47:80: error: 'constexpr bool operator<(const int&, const int&)' must have an argument of class or enumerated type
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                                ^
p541.cpp:66:11: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr pair<V1, V2> make_pair(T1&& x, T2&& y);
           ^~~~
           wait
p541.cpp:69:1: error: 'a' does not name a type
 a C++ program may contain:
 ^
p541.cpp:76:1: error: 'tuple_element' does not name a type
 tuple_element<0, pair<T1, T2>>::type
 ^~~~~~~~~~~~~
p541.cpp:84:17: error: 'tuple_element_t' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&
                 ^~~~~~~~~~~~~~~
p541.cpp:87:11: error: 'tuple_element_t' does not name a type
 constexpr tuple_element_t<I, pair<T1, T2>>&&
           ^~~~~~~~~~~~~~~
p541.cpp:90:17: error: 'tuple_element_t' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&&
                 ^~~~~~~~~~~~~~~
p541.cpp:94:18: error: 'pair' was not declared in this scope
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:94:18: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:94:24: error: expected primary-expression before ',' token
 constexpr T& get(pair<T, U>& p) noexcept;
                        ^
p541.cpp:94:27: error: expected primary-expression before '>' token
 constexpr T& get(pair<T, U>& p) noexcept;
                           ^
p541.cpp:94:30: error: 'p' was not declared in this scope
 constexpr T& get(pair<T, U>& p) noexcept;
                              ^
p541.cpp:94:14: warning: variable templates only available with -std=c++14 or -std=gnu++14
 constexpr T& get(pair<T, U>& p) noexcept;
              ^~~
p541.cpp:94:33: error: expected ';' before 'noexcept'
 constexpr T& get(pair<T, U>& p) noexcept;
                                 ^~~~~~~~
p541.cpp:96:30: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T& get(const pair<T, U>& p) noexcept;
                              ^~~~
                              wait
p541.cpp:96:34: error: expected ',' or '...' before '<' token
 constexpr const T& get(const pair<T, U>& p) noexcept;
                                  ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:96:45: error: conflicts with function declaration 'template<class T, class U> constexpr const T& get(int)'
 constexpr const T& get(const pair<T, U>& p) noexcept;
                                             ^~~~~~~~
p541.cpp:98:19: error: redeclaration of 'template<class T, class U> constexpr T&& get'
 constexpr T&& get(pair<T, U>&& p) noexcept;
                   ^~~~
p541.cpp:94:18: note: previous declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:98:19: error: 'pair' was not declared in this scope
 constexpr T&& get(pair<T, U>&& p) noexcept;
                   ^~~~
p541.cpp:98:19: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:98:25: error: expected primary-expression before ',' token
 constexpr T&& get(pair<T, U>&& p) noexcept;
                         ^
p541.cpp:98:28: error: expected primary-expression before '>' token
 constexpr T&& get(pair<T, U>&& p) noexcept;
                            ^
p541.cpp:98:32: error: label 'p' referenced outside of any function
 constexpr T&& get(pair<T, U>&& p) noexcept;
                                ^
p541.cpp:98:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
 constexpr T&& get(pair<T, U>&& p) noexcept;
               ^~~
p541.cpp:98:35: error: expected ';' before 'noexcept'
 constexpr T&& get(pair<T, U>&& p) noexcept;
                                   ^~~~~~~~
p541.cpp:100:31: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                               ^~~~
                               wait
p541.cpp:100:35: error: expected ',' or '...' before '<' token
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                                   ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:100:47: error: conflicts with function declaration 'template<class T, class U> constexpr const T&& get(int)'
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                                               ^~~~~~~~
p541.cpp:103:18: error: 'pair' was not declared in this scope
 constexpr T& get(pair<U, T>& p) noexcept;
                  ^~~~
p541.cpp:103:18: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:103:24: error: expected primary-expression before ',' token
 constexpr T& get(pair<U, T>& p) noexcept;
                        ^
p541.cpp:103:27: error: expected primary-expression before '>' token
 constexpr T& get(pair<U, T>& p) noexcept;
                           ^
p541.cpp:103:30: error: 'p' was not declared in this scope
 constexpr T& get(pair<U, T>& p) noexcept;
                              ^
p541.cpp:94:14: warning: variable templates only available with -std=c++14 or -std=gnu++14
 constexpr T& get(pair<T, U>& p) noexcept;
              ^~~
p541.cpp:103:33: error: expected ';' before 'noexcept'
 constexpr T& get(pair<U, T>& p) noexcept;
                                 ^~~~~~~~
p541.cpp:105:30: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T& get(const pair<U, T>& p) noexcept;
                              ^~~~
                              wait
p541.cpp:105:34: error: expected ',' or '...' before '<' token
 constexpr const T& get(const pair<U, T>& p) noexcept;
                                  ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:105:45: error: conflicts with function declaration 'template<class T, class U> constexpr const T& get(int)'
 constexpr const T& get(const pair<U, T>& p) noexcept;
                                             ^~~~~~~~
p541.cpp:107:19: error: redeclaration of 'template<class T, class U> constexpr T&& get'
 constexpr T&& get(pair<U, T>&& p) noexcept;
                   ^~~~
p541.cpp:94:18: note: previous declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:107:19: error: 'pair' was not declared in this scope
 constexpr T&& get(pair<U, T>&& p) noexcept;
                   ^~~~
p541.cpp:107:19: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:107:25: error: expected primary-expression before ',' token
 constexpr T&& get(pair<U, T>&& p) noexcept;
                         ^
p541.cpp:107:28: error: expected primary-expression before '>' token
 constexpr T&& get(pair<U, T>&& p) noexcept;
                            ^
p541.cpp:107:32: error: label 'p' referenced outside of any function
 constexpr T&& get(pair<U, T>&& p) noexcept;
                                ^
p541.cpp:107:15: warning: variable templates only available with -std=c++14 or -std=gnu++14
 constexpr T&& get(pair<U, T>&& p) noexcept;
               ^~~
p541.cpp:107:35: error: expected ';' before 'noexcept'
 constexpr T&& get(pair<U, T>&& p) noexcept;
                                   ^~~~~~~~
p541.cpp:109:31: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                               ^~~~
                               wait
p541.cpp:109:35: error: expected ',' or '...' before '<' token
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                                   ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:109:47: error: conflicts with function declaration 'template<class T, class U> constexpr const T&& get(int)'
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                                               ^~~~~~~~

$ g++-7 p541.cpp -std=c++17  -Wall
p541.cpp:20:8: error: redefinition of 'struct std::pair<_T1, _T2>'
 struct 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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note: previous definition of 'struct std::pair<_T1, _T2>'
     struct pair
            ^~~~
p541.cpp:47:42: error: 'T1' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                          ^~
p541.cpp:47:46: error: 'T2' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                              ^~
p541.cpp:47:48: error: template argument 1 is invalid
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                ^
p541.cpp:47:48: error: template argument 2 is invalid
p541.cpp:47:70: error: 'T1' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                      ^~
p541.cpp:47:74: error: 'T2' was not declared in this scope
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                          ^~
p541.cpp:47:76: error: template argument 1 is invalid
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                            ^
p541.cpp:47:76: error: template argument 2 is invalid
p541.cpp:47:80: error: 'constexpr bool operator<(const int&, const int&)' must have an argument of class or enumerated type
 constexpr bool operator<(const std::pair<T1, T2>& x, const std::pair<T1, T2>& y);
                                                                                ^
p541.cpp:66:11: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr pair<V1, V2> make_pair(T1&& x, T2&& y);
           ^~~~
           wait
p541.cpp:69:1: error: 'a' does not name a type
 a C++ program may contain:
 ^
p541.cpp:76:1: error: 'tuple_element' does not name a type
 tuple_element<0, pair<T1, T2>>::type
 ^~~~~~~~~~~~~
p541.cpp:84:17: error: 'tuple_element_t' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&
                 ^~~~~~~~~~~~~~~
p541.cpp:87:11: error: 'tuple_element_t' does not name a type
 constexpr tuple_element_t<I, pair<T1, T2>>&&
           ^~~~~~~~~~~~~~~
p541.cpp:90:17: error: 'tuple_element_t' does not name a type
 constexpr const tuple_element_t<I, pair<T1, T2>>&&
                 ^~~~~~~~~~~~~~~
p541.cpp:94:18: error: 'pair' was not declared in this scope
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:94:18: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:94:24: error: expected primary-expression before ',' token
 constexpr T& get(pair<T, U>& p) noexcept;
                        ^
p541.cpp:94:27: error: expected primary-expression before '>' token
 constexpr T& get(pair<T, U>& p) noexcept;
                           ^
p541.cpp:94:30: error: 'p' was not declared in this scope
 constexpr T& get(pair<T, U>& p) noexcept;
                              ^
p541.cpp:94:33: error: expected ';' before 'noexcept'
 constexpr T& get(pair<T, U>& p) noexcept;
                                 ^~~~~~~~
p541.cpp:96:30: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T& get(const pair<T, U>& p) noexcept;
                              ^~~~
                              wait
p541.cpp:96:34: error: expected ',' or '...' before '<' token
 constexpr const T& get(const pair<T, U>& p) noexcept;
                                  ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:96:45: error: conflicts with function declaration 'template<class T, class U> constexpr const T& get(int)'
 constexpr const T& get(const pair<T, U>& p) noexcept;
                                             ^~~~~~~~
p541.cpp:98:19: error: redeclaration of 'template<class T, class U> constexpr T&& get'
 constexpr T&& get(pair<T, U>&& p) noexcept;
                   ^~~~
p541.cpp:94:18: note: previous declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:98:19: error: 'pair' was not declared in this scope
 constexpr T&& get(pair<T, U>&& p) noexcept;
                   ^~~~
p541.cpp:98:19: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:98:25: error: expected primary-expression before ',' token
 constexpr T&& get(pair<T, U>&& p) noexcept;
                         ^
p541.cpp:98:28: error: expected primary-expression before '>' token
 constexpr T&& get(pair<T, U>&& p) noexcept;
                            ^
p541.cpp:98:32: error: label 'p' referenced outside of any function
 constexpr T&& get(pair<T, U>&& p) noexcept;
                                ^
p541.cpp:98:35: error: expected ';' before 'noexcept'
 constexpr T&& get(pair<T, U>&& p) noexcept;
                                   ^~~~~~~~
p541.cpp:100:31: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                               ^~~~
                               wait
p541.cpp:100:35: error: expected ',' or '...' before '<' token
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                                   ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:100:47: error: conflicts with function declaration 'template<class T, class U> constexpr const T&& get(int)'
 constexpr const T&& get(const pair<T, U>&& p) noexcept;
                                               ^~~~~~~~
p541.cpp:103:18: error: 'pair' was not declared in this scope
 constexpr T& get(pair<U, T>& p) noexcept;
                  ^~~~
p541.cpp:103:18: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:103:24: error: expected primary-expression before ',' token
 constexpr T& get(pair<U, T>& p) noexcept;
                        ^
p541.cpp:103:27: error: expected primary-expression before '>' token
 constexpr T& get(pair<U, T>& p) noexcept;
                           ^
p541.cpp:103:30: error: 'p' was not declared in this scope
 constexpr T& get(pair<U, T>& p) noexcept;
                              ^
p541.cpp:103:33: error: expected ';' before 'noexcept'
 constexpr T& get(pair<U, T>& p) noexcept;
                                 ^~~~~~~~
p541.cpp:105:30: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T& get(const pair<U, T>& p) noexcept;
                              ^~~~
                              wait
p541.cpp:105:34: error: expected ',' or '...' before '<' token
 constexpr const T& get(const pair<U, T>& p) noexcept;
                                  ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:105:45: error: conflicts with function declaration 'template<class T, class U> constexpr const T& get(int)'
 constexpr const T& get(const pair<U, T>& p) noexcept;
                                             ^~~~~~~~
p541.cpp:107:19: error: redeclaration of 'template<class T, class U> constexpr T&& get'
 constexpr T&& get(pair<U, T>&& p) noexcept;
                   ^~~~
p541.cpp:94:18: note: previous declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:107:19: error: 'pair' was not declared in this scope
 constexpr T&& get(pair<U, T>&& p) noexcept;
                   ^~~~
p541.cpp:107:19: note: suggested alternative:
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 p541.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/stl_pair.h:198:12: note:   'std::pair'
     struct pair
            ^~~~
p541.cpp:107:25: error: expected primary-expression before ',' token
 constexpr T&& get(pair<U, T>&& p) noexcept;
                         ^
p541.cpp:107:28: error: expected primary-expression before '>' token
 constexpr T&& get(pair<U, T>&& p) noexcept;
                            ^
p541.cpp:107:32: error: label 'p' referenced outside of any function
 constexpr T&& get(pair<U, T>&& p) noexcept;
                                ^
p541.cpp:107:35: error: expected ';' before 'noexcept'
 constexpr T&& get(pair<U, T>&& p) noexcept;
                                   ^~~~~~~~
p541.cpp:109:31: error: 'pair' does not name a type; did you mean 'wait'?
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                               ^~~~
                               wait
p541.cpp:109:35: error: expected ',' or '...' before '<' token
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                                   ^
p541.cpp:94:18: error: previous non-function declaration 'template<class T, class U> constexpr T& get<T, U>'
 constexpr T& get(pair<T, U>& p) noexcept;
                  ^~~~
p541.cpp:109:47: error: conflicts with function declaration 'template<class T, class U> constexpr const T&& get(int)'
 constexpr const T&& get(const pair<U, T>&& p) noexcept;
                                               ^~~~~~~~

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

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0