C++17 - The Complete Guide by Nicolai M. Josuttis
http://www.josuttis.com/cppstd17/
C++17 - The Complete Guide clang++とg++でコンパイルしてみた(まとめ)
https://qiita.com/kaizen_nagoya/items/c000f307e642990781e1
目的(purpose)
C++17 - the complete guideコンパイル記録は、コンパイラおよび対応標準、コンパイラの版により、コンパイルエラーMessageの違いを記録し、どのエラーが出たら、どの版またはどの対応標準にすればエラーが少なくなるかを考察するための資料の第一歩です。
成果(outcome)
(1)コンパイラの種類、対応標準の違いによってエラーの数が違う。
(2)同じエラーであってもMessageの表現が違う。
(3) Error Messageのネットで検索する際に役立つ。
編纂器(compiler)
clang++
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
g++
g++ (Homebrew GCC 8.1.0) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
編纂実行(Compile and go) lib
一覧(list)
clang++ | g++ | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
error | warning | link error | execute error | 出力・備考 | error | warning | link error | execute error | 出力・備考 | c/g | |
asint.cpp | 1 | from_chars() @ | 1 | from_chars() @ | |||||||
dirsize.cpp | 1 | ||||||||||
optional.cpp | ◯ | ◯ | |||||||||
optionalmember.cpp | ◯ | ◯ | |||||||||
parallelcountif.cpp | |||||||||||
variant.cpp | 1 | ◯ | 1 | ◯ | |||||||
variantvisit.cpp | 6 | 2 | error数 |
###asint
clang++ lib/asint.cpp -std=c++2a -Wall
lib/asint.cpp:12:25: error: no member named 'from_chars' in namespace 'std'
auto [ptr, ec] = std::from_chars(sv.data(), sv.data()+sv.size(),
~~~~~^
1 error generated.
g++ lib/asint.cpp -std=c++2a -Wall
lib/asint.cpp: In function 'std::optional<int> asInt(std::string_view)':
lib/asint.cpp:12:25: error: 'from_chars' is not a member of 'std'
auto [ptr, ec] = std::from_chars(sv.data(), sv.data()+sv.size(),
^~~~~~~~~~
###dirsize
clang++ lib/dirsize.cpp -std=c++2a -Wall
lib/dirsize.cpp:5:10: fatal error: 'execution' file not found
#include <execution> // for the execution policy
^~~~~~~~~~~
1 error generated.
g++ lib/dirsize.cpp -std=c++2a -Wall
lib/dirsize.cpp:5:10: fatal error: execution: No such file or directory
#include <execution> // for the execution policy
^~~~~~~~~~~
compilation terminated.
###optional
clang++ lib/optional.cpp -std=c++2a -Wall
convert '42' to int: 42
convert ' 077' to int: 77
can't convert 'hello' to int
convert '0x33' to int: 0
g++ lib/optional.cpp -std=c++2a -Wall
convert '42' to int: 42
convert ' 077' to int: 77
can't convert 'hello' to int
convert '0x33' to int: 0
###optionalmember
clang++ lib/optionalmember.cpp -std=c++2a -Wall
Jim Knopf
Donald Ervin Knuth
g++ lib/optionalmember.cpp -std=c++2a -Wall
Jim Knopf
Donald Ervin Knuth
###parallelcountif
clang++ lib/parallelcountif.cpp -std=c++2a -Wall
lib/parallelcountif.cpp:5:10: fatal error: 'execution' file not found
#include <execution> // for the execution policy
^~~~~~~~~~~
1 error generated.
g++ lib/parallelcountif.cpp -std=c++2a -Wall
lib/parallelcountif.cpp:5:10: fatal error: execution: No such file or directory
#include <execution> // for the execution policy
^~~~~~~~~~~
compilation terminated.
###variant
clang++ lib/variant.cpp -std=c++2a -Wall
lib/variant.cpp:14:9: warning: unused variable 'i' [-Wunused-variable]
int i = std::get<0>(var); // access by index
^
1 warning generated.
1
0
EXCEPTION: bad_variant_access
g++ lib/variant.cpp -std=c++2a -Wall
lib/variant.cpp: In function 'int main()':
lib/variant.cpp:14:9: warning: unused variable 'i' [-Wunused-variable]
int i = std::get<0>(var); // access by index
^
1
0
EXCEPTION: Unexpected index
###variantvisit
clang++ lib/variantvisit.cpp -std=c++2a -Wall
In file included from lib/variantvisit.cpp:2:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:585:5: error: static_assert failed due to requirement 'is_invocable_v<MyVisitor, double &>' "`std::visit` requires the visitor to be exhaustive."
static_assert(is_invocable_v<_Visitor, _Values...>,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:594:7: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__std_visit_exhaustive_visitor_check<MyVisitor, double &>' requested here
__std_visit_exhaustive_visitor_check<
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4488:23: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>::operator()<std::__1::__variant_detail::__alt<2, double> &>' requested here
_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__config:447:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:489:16: note: while substituting deduced template arguments into function template '__invoke_constexpr' [with _Fp = std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, _Args = <std::__1::__variant_detail::__alt<2, double> &>]
return __invoke_constexpr(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:498:43: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__dispatcher<2>::__dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:525:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __make_dispatch<_Fp, _Vs...>(__is);
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:533:34: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:450:9: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
__make_fmatrix<_Visitor&&,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:559:20: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::__variant_detail::__impl<int, std::__1::basic_string<char>, double> &>' requested here
return __base::__visit_alt(_VSTD::forward<_Visitor>(__visitor),
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:577:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __visit_alt(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1521:21: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_value<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor),
^
lib/variantvisit.cpp:22:8: note: in instantiation of function template specialization 'std::__1::visit<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
std::visit(MyVisitor(), var); // calls operator() for int
^
In file included from lib/variantvisit.cpp:2:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:597:14: error: attempt to use a deleted function
return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:4488:23: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>::operator()<std::__1::__variant_detail::__alt<2, double> &>' requested here
_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/__config:447:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:489:16: note: while substituting deduced template arguments into function template '__invoke_constexpr' [with _Fp = std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, _Args = <std::__1::__variant_detail::__alt<2, double> &>]
return __invoke_constexpr(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:498:43: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__dispatcher<2>::__dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:525:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __make_dispatch<_Fp, _Vs...>(__is);
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:533:34: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix_impl<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:540:12: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
return __make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:450:9: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
__make_fmatrix<_Visitor&&,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:559:20: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::__variant_detail::__impl<int, std::__1::basic_string<char>, double> &>' requested here
return __base::__visit_alt(_VSTD::forward<_Visitor>(__visitor),
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:577:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __visit_alt(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1521:21: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_value<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor),
^
lib/variantvisit.cpp:22:8: note: in instantiation of function template specialization 'std::__1::visit<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
std::visit(MyVisitor(), var); // calls operator() for int
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1666:5: note: '~__nat' has been explicitly marked deleted here
~__nat() = delete;
^
In file included from lib/variantvisit.cpp:2:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:489:16: error: attempt to use a deleted function
return __invoke_constexpr(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:498:43: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__dispatcher<2>::__dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:525:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __make_dispatch<_Fp, _Vs...>(__is);
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:533:34: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix_impl<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:540:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix_impl<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 0, 1, 2>' requested here
return __make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:450:9: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
__make_fmatrix<_Visitor&&,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:559:20: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::__variant_detail::__impl<int, std::__1::basic_string<char>, double> &>' requested here
return __base::__visit_alt(_VSTD::forward<_Visitor>(__visitor),
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:577:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __visit_alt(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1521:21: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_value<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor),
^
lib/variantvisit.cpp:22:8: note: in instantiation of function template specialization 'std::__1::visit<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
std::visit(MyVisitor(), var); // calls operator() for int
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/type_traits:1666:5: note: '~__nat' has been explicitly marked deleted here
~__nat() = delete;
^
In file included from lib/variantvisit.cpp:2:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:498:12: error: cannot deduce return type 'auto' from returned value of type '<overloaded function type>'
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:525:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __make_dispatch<_Fp, _Vs...>(__is);
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:533:34: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix_impl<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 2>' requested here
return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:540:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix_impl<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &, 0, 1, 2>' requested here
return __make_fmatrix_impl<_Fp, _Vs...>(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:450:9: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__make_fmatrix<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor> &&, std::__1::__variant_detail::__base<std::__1::__variant_detail::_Trait::_Available, int, std::__1::basic_string<char>, double> &>' requested here
__make_fmatrix<_Visitor&&,
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:559:20: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__base::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::__variant_detail::__impl<int, std::__1::basic_string<char>, double> &>' requested here
return __base::__visit_alt(_VSTD::forward<_Visitor>(__visitor),
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:577:12: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_alt<std::__1::__variant_detail::__visitation::__variant::__value_visitor<MyVisitor>, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __visit_alt(
^
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1521:21: note: in instantiation of function template specialization 'std::__1::__variant_detail::__visitation::__variant::__visit_value<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor),
^
lib/variantvisit.cpp:22:8: note: in instantiation of function template specialization 'std::__1::visit<MyVisitor, std::__1::variant<int, std::__1::basic_string<char>, double> &>' requested here
std::visit(MyVisitor(), var); // calls operator() for int
^
lib/variantvisit.cpp:24:3: error: no matching function for call to 'visit'
std::visit(MyVisitor(), var); // calls operator() for string
^~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1513:26: note: candidate template ignored: substitution failure [with _Visitor = MyVisitor, _Vs = <std::__1::variant<int, std::__1::basic_string<char>, double> &>]
constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
^
lib/variantvisit.cpp:26:3: error: no matching function for call to 'visit'
std::visit(MyVisitor(), var); // calls operator() for long double
^~~~~~~~~~
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/variant:1513:26: note: candidate template ignored: substitution failure [with _Visitor = MyVisitor, _Vs = <std::__1::variant<int, std::__1::basic_string<char>, double> &>]
constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
^
6 errors generated.
g++ lib/variantvisit.cpp -std=c++2a -Wall
In file included from lib/variantvisit.cpp:2:
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant: In instantiation of 'static constexpr decltype(auto) std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...)>, std::tuple<_Rest ...>, std::integer_sequence<long unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = void; _Visitor = MyVisitor&&; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {2}]':
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:848:28: required from 'static constexpr auto std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...)>, std::tuple<_Rest ...>, std::integer_sequence<long unsigned int, __indices ...> >::_S_apply() [with _Result_type = void; _Visitor = MyVisitor&&; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {2}]'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:825:61: required from 'static constexpr void std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...), __dimensions ...>, std::tuple<_Variants ...>, std::integer_sequence<long unsigned int, __indices ...> >::_S_apply_single_alt(_Tp&) [with long unsigned int __index = 2; _Tp = std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&)>; _Result_type = void; _Visitor = MyVisitor&&; long unsigned int ...__dimensions = {3}; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {}]'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:813:39: required from 'constexpr const std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&), 3> std::__detail::__variant::__gen_vtable<void, MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>::_S_vtable'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:866:29: required from 'struct std::__detail::__variant::__gen_vtable<void, MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:1394:23: required from 'constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...) [with _Visitor = MyVisitor; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}]'
lib/variantvisit.cpp:22:30: required from here
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:866:49: in 'constexpr' expansion of 'std::__detail::__variant::__gen_vtable<void, MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>::_S_apply()'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:863:38: in 'constexpr' expansion of 'std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&), 3>, std::tuple<std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>, std::integer_sequence<long unsigned int> >::_S_apply()'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:803:19: in 'constexpr' expansion of 'std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&), 3>, std::tuple<std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>, std::integer_sequence<long unsigned int> >::_S_apply_all_alts<0, 1, 2>(#'result_decl' not supported by dump_expr#<expression error>, (std::make_index_sequence<3>(), std::make_index_sequence<3>()))'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:841:17: error: no matching function for call to '__invoke(MyVisitor, std::variant_alternative_t<2, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double> >&)'
return __invoke(std::forward<_Visitor>(__visitor),
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
std::get<__indices>(
~~~~~~~~~~~~~~~~~~~~
std::forward<_Variants>(__vars))...);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:42,
from lib/variantvisit.cpp:2:
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/bits/invoke.h:89:5: note: candidate: 'template<class _Callable, class ... _Args> constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...)'
__invoke(_Callable&& __fn, _Args&&... __args)
^~~~~~~~
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/bits/invoke.h:89:5: note: template argument deduction/substitution failed:
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/bits/invoke.h: In substitution of 'template<class _Callable, class ... _Args> constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = MyVisitor; _Args = {double&}]':
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:841:17: required from 'static constexpr decltype(auto) std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...)>, std::tuple<_Rest ...>, std::integer_sequence<long unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = void; _Visitor = MyVisitor&&; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {2}]'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:848:28: required from 'static constexpr auto std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...)>, std::tuple<_Rest ...>, std::integer_sequence<long unsigned int, __indices ...> >::_S_apply() [with _Result_type = void; _Visitor = MyVisitor&&; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {2}]'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:825:61: required from 'static constexpr void std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...), __dimensions ...>, std::tuple<_Variants ...>, std::integer_sequence<long unsigned int, __indices ...> >::_S_apply_single_alt(_Tp&) [with long unsigned int __index = 2; _Tp = std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&)>; _Result_type = void; _Visitor = MyVisitor&&; long unsigned int ...__dimensions = {3}; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}; long unsigned int ...__indices = {}]'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:813:39: required from 'constexpr const std::__detail::__variant::_Multi_array<void (*)(MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&), 3> std::__detail::__variant::__gen_vtable<void, MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>::_S_vtable'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:866:29: required from 'struct std::__detail::__variant::__gen_vtable<void, MyVisitor&&, std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&>'
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/variant:1394:23: required from 'constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...) [with _Visitor = MyVisitor; _Variants = {std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double>&}]'
lib/variantvisit.cpp:22:30: required from here
/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/bits/invoke.h:89:5: error: no type named 'type' in 'struct std::__invoke_result<MyVisitor, double&>'
検討事項(agenda)
1)コンパイルエラーをなくす修正方法
2)役に立つまたは意味のあるその他の出力
台本(script)
毎回コンパイル条件を変えてコンパイルするのに、一気にコンパイルする方法
#!/bin/bash
while read line
do
echo "clang++ $line -std=c++2a -Wall"
clang++ $line -std=c++2a -Wall
if [ -e a.out ]; then
./a.out
rm a.out
fi
echo "g++ $line -std=c++2a -Wall"
g++ $line -std=c++2a -Wall
if [ -e a.out ]; then
./a.out
rm a.out
fi
done < ./$1
#!/bin/bash
while read line
do
ls ./$line/*.cpp > ./$line/$line
./cga.sh ./$line/$line > $line.log.txt &> $line.log.txt
done < ./$1
参考資料(reference)
プログラミング言語教育のXYZ
https://qiita.com/kaizen_nagoya/items/1950c5810fb5c0b07be4
プログラミング言語教育のXYZ(youtube)
https://www.youtube.com/watch?v=He1_tg4px-w&t=486s
#Autosar Guidelines C++14
Autosar Guidelines C++14 example code compile list(1-169)
https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76
C++N4741 2018
Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4741.pdf
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010
C++N4606 2016
Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
C++N4606, 2016符号断片編纂一覧(example code compile list)
Working Draft 2016, ISO/IEC 14882(1)
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
CEDD(Compile Error Driven Design)
初めての CEDD(Compile Error Driven Design) 8回直してコンパイル。
https://qiita.com/kaizen_nagoya/items/9494236aa1753f3fd1e1
コンパイルエラーを記録するとよい理由7つ
https://qiita.com/kaizen_nagoya/items/85c0e92b206883140e89
docker gnu(gcc/g++) and llvm(clang/clang++)
https://qiita.com/drafts/059874ea39c4de64c0f7
[C][C++]の国際規格案の例題をコンパイルするときの課題7つ。
https://qiita.com/kaizen_nagoya/items/5f4b155030259497c4de
C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da
Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f
C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff
Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d
cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67
MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74
C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed
ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1
C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a
C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9
'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11
Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc
MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb
どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00
MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671
C++ Support(0)
https://qiita.com/kaizen_nagoya/items/8720d26f762369a80514
Coding Rules(0) C Secure , MISRA and so on
https://qiita.com/kaizen_nagoya/items/400725644a8a0e90fbb0
Ethernet 記事一覧 Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794
Wireshark 一覧 wireshark(0)、Ethernet(48)
https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0
線網(Wi-Fi)空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001
OSEK OS設計の基礎 OSEK(100)
https://qiita.com/kaizen_nagoya/items/7528a22a14242d2d58a3
Error一覧(C/C++, python, bash...) Error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8
なぜdockerで機械学習するか 書籍・ソース一覧作成中 (目標100)
https://qiita.com/kaizen_nagoya/items/ddd12477544bf5ba85e2
言語処理100本ノックをdockerで。python覚えるのに最適。:10+12
https://qiita.com/kaizen_nagoya/items/7e7eb7c543e0c18438c4
プログラムちょい替え(0)一覧:4件
https://qiita.com/kaizen_nagoya/items/296d87ef4bfd516bc394
TOPPERSまとめ #名古屋のIoTは名古屋のOSで
https://qiita.com/kaizen_nagoya/items/9026c049cb0309b9d451
docker(0) 資料集
https://qiita.com/kaizen_nagoya/items/45699eefd62677f69c1d
Qiita-dockerお宝鑑定団
https://qiita.com/kaizen_nagoya/items/509e125263559b5aed5b
The C++ Standard Library: clang++とg++でコンパイルしてみた(まとめ):14件
https://qiita.com/kaizen_nagoya/items/9bdfaa392443d13e5759
C++17 - The Complete Guide clang++とg++でコンパイルしてみた(まとめ):4件
https://qiita.com/kaizen_nagoya/items/c000f307e642990781e1
C++N3242, 2011, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/685b5c1a2c17c1bf1318
C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010
C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91
Autosar Guidelines C++14 example code compile list(1-169)
https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76
プログラマによる、プログラマのための、統計と確率のプログラミングとその後 統計と確率一覧(0)
https://qiita.com/kaizen_nagoya/items/6e9897eb641268766909
プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945
一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
This article is an individual impression based on the individual's experience. It has nothing to do with the organization or business to which I currently belong.
文書履歴(document history)
文献履歴(document history)
ver. 0.10 初稿 20180616
ver. 0.11 一覧追記 20180617
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Thank you very much for reading to the last sentence.
Please press the like icon 💚 and follow me for your happy life.