0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C++N4606(246) 20.5.2.7 Element access [tuple.elem]p554

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.

(246) 20.5.2.7 Element access [tuple.elem]p554

算譜(source code)

p554.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(246) 20.5.2.7 Element access [tuple.elem]p554.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>
#include <tuple>
#include <utility>/// for get

const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);///add std:: to tuple by clang++
const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
const double& d = std::get<double>(t); // ERROR. ill-formed /// add std:: to get by clang++

int main() {
  std::cout << "i1=" << i1 << " i2="<< i2 << std::endl;/// add cout
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

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

cppall.sh
$ ./cppall.sh p554
$ clang++ p554.cpp -std=c++03 -Wall
p554.cpp:11:12: error: no template named 'tuple' in namespace 'std'
const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);//add std:: to tuple for clang++
      ~~~~~^
1 error generated.
$ clang++ p554.cpp -std=c++11 -Wall
p554.cpp:12:17: error: no matching function for call to 'get'
const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1
                ^~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:230:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:235:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:241:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:246:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:746:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:754:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:763:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:771:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:604:60: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
                                                           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:606:66: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
                                                                 ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:608:61: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
                                                            ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:610:67: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
                                                                  ^
p554.cpp:13:17: error: no matching function for call to 'get'
const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2
                ^~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:230:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:235:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:241:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:246:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:746:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:754:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:763:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:771:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:604:60: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
                                                           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:606:66: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
                                                                 ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:608:61: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
                                                            ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:610:67: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
                                                                  ^
p554.cpp:14:19: error: no matching function for call to 'get'
const double& d = std::get<double>(t); // ERROR. ill-formed
                  ^~~~~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:230:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:235:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:241:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:246:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:746:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:754:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:763:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:771:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:604:60: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
                                                           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:606:66: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
                                                                 ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:608:61: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
                                                            ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:610:67: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
                                                                  ^
3 errors generated.
$ clang++ p554.cpp -std=c++17 -Wall
In file included from p554.cpp:6:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/iostream:38:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/ios:216:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/__locale:15:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/string:477:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/string_view:176:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/__string:56:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/algorithm:643:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/memory:662:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:1018:5: error: static_assert failed "type occurs more than once in type list"
    static_assert(value != __ambiguous, "type occurs more than once in type list");
    ^             ~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:1030:14: note: in instantiation of template class
      'std::__1::__find_detail::__find_exactly_one_checked<double, int, const int, double, double>' requested here
    : public __find_detail::__find_exactly_one_checked<_T1, _Args...> {
             ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:1044:23: note: in instantiation of template class 'std::__1::__find_exactly_one_t<double, int, const int,
      double, double>' requested here
    return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
                      ^
p554.cpp:14:24: note: in instantiation of function template specialization 'std::__1::get<double, int, const int, double, double>' requested here
const double& d = std::get<double>(t); // ERROR. ill-formed
                       ^
1 error generated.

$ g++-7 p554.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 p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
p554.cpp:11:12: error: 'tuple' in namespace 'std' does not name a template type
 const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);//add std:: to tuple for clang++
            ^~~~~
p554.cpp:12:22: error: 'get' is not a member of 'std'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1
                      ^~~
p554.cpp:12:26: error: expected primary-expression before 'int'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1
                          ^~~
p554.cpp:13:22: error: 'get' is not a member of 'std'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2
                      ^~~
p554.cpp:13:26: error: expected primary-expression before 'const'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2
                          ^~~~~
p554.cpp:14:24: error: 'get' is not a member of 'std'
 const double& d = std::get<double>(t); // ERROR. ill-formed
                        ^~~
p554.cpp:14:28: error: expected primary-expression before 'double'
 const double& d = std::get<double>(t); // ERROR. ill-formed
                            ^~~~~~

$ g++-7 p554.cpp -std=c++11  -Wall
p554.cpp:12:32: error: no matching function for call to 'get<int>(const std::tuple<int, const int, double, double>&)'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1
                                ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:38:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:39:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note:   template argument deduction/substitution failed:
In file included from p554.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note:   template argument deduction/substitution failed:
p554.cpp:13:38: error: no matching function for call to 'get<const int>(const std::tuple<int, const int, double, double>&)'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2
                                      ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:38:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:39:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note:   template argument deduction/substitution failed:
In file included from p554.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note:   template argument deduction/substitution failed:
p554.cpp:14:37: error: no matching function for call to 'get<double>(const std::tuple<int, const int, double, double>&)'
 const double& d = std::get<double>(t); // ERROR. ill-formed
                                     ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:38:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:39:0,
                 from p554.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note:   template argument deduction/substitution failed:
In file included from p554.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note:   template argument deduction/substitution failed:

$ g++-7 p554.cpp -std=c++17  -Wall
In file included from p554.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple: In instantiation of 'constexpr const _Tp& std::get(const std::tuple<_Elements ...>&) [with _Tp = double; _Types = {int, const int, double, double}]':
p554.cpp:14:37:   required from here
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1362:37: error: no matching function for call to '__get_helper2<double>(const std::tuple<int, const int, double, double>&)'
     { return std::__get_helper2<_Tp>(__t); }
              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1338:5: note: candidate: template<class _Head, long unsigned int __i, class ... _Tail> constexpr _Head& std::__get_helper2(std::_Tuple_impl<__i, _Head, _Tail ...>&)
     __get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
     ^~~~~~~~~~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1338:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1362:37: note:   types 'std::_Tuple_impl<__i, double, _Tail ...>' and 'const std::tuple<int, const int, double, double>' have incompatible cv-qualifiers
     { return std::__get_helper2<_Tp>(__t); }
              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1343:5: note: candidate: template<class _Head, long unsigned int __i, class ... _Tail> constexpr const _Head& std::__get_helper2(const std::_Tuple_impl<__i, _Head, _Tail ...>&)
     __get_helper2(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
     ^~~~~~~~~~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1343:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1362:37: note:   mismatched types 'double' and 'int'
     { return std::__get_helper2<_Tp>(__t); }
              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1362:37: note:   mismatched types 'double' and 'const int'
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1362:37: note:   'const std::_Tuple_impl<__i, double, _Tail ...>' is an ambiguous base class of 'const std::tuple<int, const int, double, double>'

##コンパイルエラーを想定した行を註釈に

###算譜(source code)

p544a.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(246) 20.5.2.7 Element access [tuple.elem]p554.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>
#include <tuple>
#include <utility>/// for get

const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);///add std:: to tuple by clang++
const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
//const double& d = std::get<double>(t); // ERROR. ill-formed /// add std:: to get by clang++

int main() {
  std::cout << "i1=" << i1 << " i2="<< i2 << std::endl;
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}

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

cppall.sh
$ ./cppall.sh p554a
$ clang++ p554a.cpp -std=c++03 -Wall
p554a.cpp:11:12: error: no template named 'tuple' in namespace 'std'
const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);///add std:: to tuple by clang++
      ~~~~~^
1 error generated.
$ clang++ p554a.cpp -std=c++11 -Wall
p554a.cpp:12:17: error: no matching function for call to 'get'
const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
                ^~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:230:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:235:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:241:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:246:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:746:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:754:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:763:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:771:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:604:60: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
                                                           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:606:66: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
                                                                 ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:608:61: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
                                                            ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:610:67: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
                                                                  ^
p554a.cpp:13:17: error: no matching function for call to 'get'
const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
                ^~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:230:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:235:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:241:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__tuple:246:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const array<_Tp, _Size>&&) _NOEXCEPT;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:746:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:754:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:763:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/utility:771:1: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Ip'
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:604:60: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
                                                           ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:606:66: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
                                                                 ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:608:61: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
                                                            ^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/tuple:610:67: note: candidate template ignored: invalid explicitly-specified argument for template parameter
      '_Jp'
        const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
                                                                  ^
2 errors generated.
$ clang++ p554a.cpp -std=c++17 -Wall
i1=1 i2=2
C++N4606(246) 20.5.2.7 Element access [tuple.elem]p554.cpp

$ g++-7 p554a.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 p554a.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
p554a.cpp:11:12: error: 'tuple' in namespace 'std' does not name a template type
 const std::tuple<int, const int, double, double> t(1, 2, 3.4, 5.6);///add std:: to tuple by clang++
            ^~~~~
p554a.cpp:12:22: error: 'get' is not a member of 'std'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
                      ^~~
p554a.cpp:12:26: error: expected primary-expression before 'int'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
                          ^~~
p554a.cpp:13:22: error: 'get' is not a member of 'std'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
                      ^~~
p554a.cpp:13:26: error: expected primary-expression before 'const'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
                          ^~~~~

$ g++-7 p554a.cpp -std=c++11  -Wall
p554a.cpp:12:32: error: no matching function for call to 'get<int>(const std::tuple<int, const int, double, double>&)'
 const int& i1 = std::get<int>(t); // OK. Not ambiguous. i1 == 1 ///add std:: to get by clang++
                                ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:38:0,
                 from p554a.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:39:0,
                 from p554a.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note:   template argument deduction/substitution failed:
In file included from p554a.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note:   template argument deduction/substitution failed:
p554a.cpp:13:38: error: no matching function for call to 'get<const int>(const std::tuple<int, const int, double, double>&)'
 const int& i2 = std::get<const int>(t); // OK. Not ambiguous. i2 == 2/// add std:: to get by clang++
                                      ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:38:0,
                 from p554a.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:229:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:234:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/utility:239:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:39:0,
                 from p554a.cpp:8:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:307:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:316:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/array:324:5: note:   template argument deduction/substitution failed:
In file included from p554a.cpp:8:0:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1314:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1320:5: note:   template argument deduction/substitution failed:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/tuple:1326:5: note:   template argument deduction/substitution failed:

$ g++-7 p554a.cpp -std=c++17  -Wall
i1=1 i2=2
C++N4606(246) 20.5.2.7 Element access [tuple.elem]p554.cpp

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

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

0
0
0

Register as a new user and use Qiita more conveniently

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?