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.

17.3.2 Header <version> synopsis [version.syn] C++N4910:2022 (270) p499.cpp

Posted at

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

n4910は、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)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

<この項は書きかけです。順次追記します。>

背景(back ground)

C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。

https://stackoverflow.com
https://cpprefjp.github.io
http://ja.cppreference.com/

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

作業方針(sequence)

Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、

1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list

C++N4606, 2016符号断片編纂一覧(example code compile list)

C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

C++N3242, 2011 sample code compile list on clang++ and g++

編纂器(Compiler)

clang++ --version

Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

g++- --version

g++ (GCC) 12.1.0 Copyright (C) 2022 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.

17.3.2 Header synopsis [version.syn] C++N4910:2022 (270) p499.cpp

算譜(source code)

p499.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "17.3.2 Header <version> synopsis [version.syn] C++N4910:2022 (270) p499.cpp";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

#include <iostream>
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>
#include <atomic>
#include <unordered_map>
#include <typeinfo>

using namespace std;

// [Note 1: Future revisions of C++ might replace the values of these macros with greater values. —end note]
#define __cpp_lib_addressof_constexpr  201603L // also in <memory> 
#define __cpp_lib_allocate_at_least  202106L // also in <memory> 
#define __cpp_lib_allocator_traits_is_always_equal  201411L // also in <memory>, <scoped_allocator>, <string>, <deque>, <forward_list>, <list>, <vector>, 
// <map>, <set>, <unordered_map>, <unordered_set>
#define __cpp_lib_adaptor_iterator_pair_constructor 202106L // also in <stack>, <queue> 
#define __cpp_lib_any 201606L // also in <any>
#define __cpp_lib_apply 201603L // also in <tuple>
#define __cpp_lib_array_constexpr 201811L // also in <iterator>, <array> 
#define __cpp_lib_as_const 201510L // also in <utility>
#define __cpp_lib_associative_heterogeneous_erasure 202110L // also in <map>, <set>, <unordered_map>, <unordered_set>
#define __cpp_lib_assume_aligned 201811L // also in <memory>
#define __cpp_lib_atomic_flag_test 201907L // also in <atomic>
#define __cpp_lib_atomic_float 201711L // also in <atomic>
#define __cpp_lib_atomic_is_always_lock_free  201603L // also in <atomic>
#define __cpp_lib_atomic_lock_free_type_aliases  201907L // also in <atomic>
#define __cpp_lib_atomic_ref 201806L // also in <atomic>
#define __cpp_lib_atomic_shared_ptr 201711L // also in <memory>
#define __cpp_lib_atomic_value_initialization 201911L // also in <atomic>, <memory> 
#define __cpp_lib_atomic_wait 201907L // also in <atomic>
#define __cpp_lib_barrier 201907L // also in <barrier> 
#define __cpp_lib_bind_back 202202L // also in <functional> 
#define __cpp_lib_bind_front 201907L // also in <functional> 
#define __cpp_lib_bit_cast 201806L // also in <bit>
#define __cpp_lib_bitops 201907L // also in <bit>
#define __cpp_lib_bool_constant 201505L // also in <type_traits> 
#define __cpp_lib_bounded_array_traits  201902L // also in <type_traits> 
#define __cpp_lib_boyer_moore_searcher  201603L // also in <functional> 
#define __cpp_lib_byte 201603L // also in <cstddef> 
#define __cpp_lib_byteswap 202110L // also in <bit>
#define __cpp_lib_char8_t 201907L
// also in <atomic>, <filesystem>, <istream>, <limits>, <locale>, <ostream>, <string>, <string_view>
#define __cpp_lib_chrono  201907L // also in <chrono> 
#define __cpp_lib_chrono_udls 201304L // also in <chrono>
#define __cpp_lib_clamp 201603L // also in <algorithm> 
#define __cpp_lib_complex_udls 201309L // also in <complex>
#define __cpp_lib_concepts 202002L // also in <concepts>
#define __cpp_lib_constexpr_algorithms  201806L // also in <algorithm> 
#define __cpp_lib_constexpr_cmath 202202L // also in <cmath>, <cstdlib> 
#define __cpp_lib_constexpr_complex  201711L // also in <complex>
#define __cpp_lib_constexpr_dynamic_alloc 201907L // also in <memory> 
#define __cpp_lib_constexpr_functional 201907L // also in <functional> 
#define __cpp_lib_constexpr_iterator 201811L // also in <iterator> 
#define __cpp_lib_constexpr_memory 202202L // also in <memory> 
#define __cpp_lib_constexpr_numeric 201911L // also in <numeric> 
#define __cpp_lib_constexpr_string 201907L // also in <string> 
#define __cpp_lib_constexpr_string_view 201811L // also in <string_view> 
#define __cpp_lib_constexpr_tuple 201811L // also in <tuple> 
#define __cpp_lib_constexpr_typeinfo  202106L // also in <typeinfo> 
#define __cpp_lib_constexpr_utility 201811L // also in <utility> 
#define __cpp_lib_constexpr_vector 201907L // also in <vector> 
#define __cpp_lib_containers_ranges 202202L
// also in <vector>, <list>, <forward_list>, <map>, <set>, <unordered_map>, <unordered_set>, 
// <deque>, <queue>, <stack>, <string>
#define __cpp_lib_coroutine 201902L // also in <coroutine> 
#define __cpp_lib_destroying_delete  201806L // also in <new> 
#define __cpp_lib_enable_shared_from_this #define __cpp_lib_endian 201603L // also in <memory> 
#define __cpp_lib_erase_if 201907L // also in <bit> 
// also in <string>, <deque>, <forward_list>, <list>, <vector>, <map>, <set>, <unordered_map>, 
// <unordered_set>
#define __cpp_lib_exchange_function  201304L // also in <utility> 
#define __cpp_lib_execution 201902L // also in <execution> 
#define __cpp_lib_expected 202202L // also in <expected> 
#define __cpp_lib_filesystem 201703L // also in <filesystem> 
#define __cpp_lib_format 202110L // also in <format> 
#define __cpp_lib_gcd_lcm 201606L // also in <numeric> 
#define __cpp_lib_generic_associative_lookup  201304L // also in <map>, <set> 
#define __cpp_lib_generic_unordered_lookup 201811L
// also in <unordered_map>, <unordered_set>
#define __cpp_lib_hardware_interference_size 201703L // also in <new>
#define __cpp_lib_has_unique_object_representations 201606L // also in <type_traits> 
#define __cpp_lib_hypot 201603L // also in <cmath> 
#define __cpp_lib_incomplete_container_elements 201505L
// also in <forward_list>, <list>, <vector> 
#define __cpp_lib_int_pow2 202002L
#define __cpp_lib_integer_comparison_functions 202002L // also in <utility>
#define __cpp_lib_integer_sequence 201304L // also in <utility>
#define __cpp_lib_integral_constant_callable  201304L // also in <type_traits>
#define __cpp_lib_interpolate 201902L // also in <cmath>, <numeric> 
#define __cpp_lib_invoke 201411L // also in <functional>
#define __cpp_lib_invoke_r 202106L // also in <functional>
#define __cpp_lib_is_aggregate 201703L // also in <type_traits>
#define __cpp_lib_is_constant_evaluated  201811L // also in <type_traits>
#define __cpp_lib_is_final 201402L // also in <type_traits>
#define __cpp_lib_is_invocable 201703L // also in <type_traits>
#define __cpp_lib_is_layout_compatible  201907L // also in <type_traits>
#define __cpp_lib_is_nothrow_convertible 201806L // also in <type_traits>
#define __cpp_lib_is_null_pointer 201309L // also in <type_traits>
#define __cpp_lib_is_pointer_interconvertible  201907L // also in <type_traits>
#define __cpp_lib_is_scoped_enum 202011L // also in <type_traits>
#define __cpp_lib_is_swappable 201603L // also in <type_traits>
#define __cpp_lib_jthread 201911L // also in <stop_token>, <thread> 
#define __cpp_lib_latch  201606L // also in <new>
#define __cpp_lib_launder 201806L // also in <forward_list>, <list> 
#define __cpp_lib_list_remove_return_type 201510L // also in <type_traits>
#define __cpp_lib_logical_traits 201606L // also in <tuple>
#define __cpp_lib_make_from_tuple
#define __cpp_lib_make_reverse_iterator  201402L // also in <iterator> 
#define __cpp_lib_make_unique 201304L // also in <memory>
#define __cpp_lib_map_try_emplace  201411L // also in <map>
#define __cpp_lib_math_constants 201907L // also in <numbers>
#define __cpp_lib_math_special_functions  201603L // also in <cmath>
#define __cpp_lib_memory_resource 201603L // also in <memory_resource> 
#define __cpp_lib_move_only_function 202110L // also in <functional> 
#define __cpp_lib_node_extract 201606L
// also in <map>, <set>, <unordered_map>, <unordered_set> 
#define __cpp_lib_nonmember_container_access   201411L
// also in <array>, <deque>, <forward_list>, <iterator>, <list>, <map>, <regex>, <set>, <string>, 
// <unordered_map>, <unordered_set>, <vector>
#define __cpp_lib_not_fn 201603L // also in <functional>
#define __cpp_lib_null_iterators 201304L // also in <iterator>
#define __cpp_lib_optional 202110L // also in <optional>
#define __cpp_lib_out_ptr 202106L // also in <memory>
#define __cpp_lib_parallel_algorithm 201603L // also in <algorithm>, <numeric> 
#define __cpp_lib_polymorphic_allocator 201902L // also in <memory_resource> 
#define __cpp_lib_quoted_string_io 201304L // also in <iomanip>
#define __cpp_lib_ranges 202202L
// also in <algorithm>, <functional>, <iterator>, <memory>, <ranges>
#define __cpp_lib_ranges_chunk 202202L // also in <ranges>
#define __cpp_lib_ranges_chunk_by 202202L // also in <ranges>
#define __cpp_lib_ranges_iota 202202L // also in <numeric>
#define __cpp_lib_ranges_join_with 202202L // also in <ranges>
#define __cpp_lib_ranges_slide 202202L // also in <ranges>
#define __cpp_lib_ranges_starts_ends_with 202106L // also in <algorithm>
#define __cpp_lib_ranges_to_container 202202L // also in <ranges>
#define __cpp_lib_ranges_zip 202110L // also in <ranges>, <tuple>, <utility> 
#define __cpp_lib_raw_memory_algorithms 201606L // also in <memory>
#define __cpp_lib_reference_from_temporary 202202L // also in <type_traits>
#define __cpp_lib_remove_cvref 201711L // also in <type_traits>
#define __cpp_lib_result_of_sfinae 201210L // also in <functional>, <type_traits> 
#define __cpp_lib_robust_nonmodifying_seq_ops 201304L // also in <algorithm>
#define __cpp_lib_sample 201603L // also in <algorithm>
#define __cpp_lib_scoped_lock 201703L // also in <mutex>
#define __cpp_lib_semaphore 201907L // also in <semaphore>
#define __cpp_lib_shared_mutex 201505L // also in <shared_mutex>
#define __cpp_lib_shared_ptr_arrays 201707L // also in <memory>
#define __cpp_lib_shared_ptr_weak_type 201606L // also in <memory>
#define __cpp_lib_shared_timed_mutex 201402L // also in <shared_mutex>
#define __cpp_lib_shift 202202L // also in <algorithm>
#define __cpp_lib_smart_ptr_for_overwrite 202002L // also in <memory>
#define __cpp_lib_source_location 201907L // also in <source_location>
#define __cpp_lib_span 202002L // also in <span>
#define __cpp_lib_spanstream 202106L // also in <spanstream>
#define __cpp_lib_ssize 201902L // also in <iterator>
#define __cpp_lib_stacktrace 202011L // also in <stacktrace>
#define __cpp_lib_starts_ends_with 201711L // also in <string>, <string_view> 
#define __cpp_lib_stdatomic_h 202011L // also in <stdatomic.h>
#define __cpp_lib_string_contains 202011L // also in <string>, <string_view> 
#define __cpp_lib_string_resize_and_overwrite 202110L // also in <string>
#define __cpp_lib_string_udls 201304L // also in <string>
#define __cpp_lib_string_view 201803L // also in <string>, <string_view> 
#define __cpp_lib_syncbuf 201803L // also in <syncstream>
#define __cpp_lib_three_way_comparison 201907L // also in <compare>
#define __cpp_lib_to_address 201711L // also in <memory>
#define __cpp_lib_to_array 201907L // also in <array>
#define __cpp_lib_to_chars 201611L // also in <charconv>
#define __cpp_lib_to_underlying 202102L // also in <utility>
#define __cpp_lib_transformation_trait_aliases  201304L // also in <type_traits>
#define __cpp_lib_transparent_operators 201510L // also in <memory>, <functional> 
#define __cpp_lib_tuple_element_t 201402L // also in <tuple>
#define __cpp_lib_tuples_by_type 201304L // also in <utility>, <tuple>
#define __cpp_lib_type_identity 201806L
#define __cpp_lib_type_trait_variable_templates  201510L
#define __cpp_lib_uncaught_exceptions 201411L
#define __cpp_lib_unordered_map_try_emplace  201411L
#define __cpp_lib_unreachable 202202L
#define __cpp_lib_unwrap_ref 201811L
#define __cpp_lib_variant 202106L
#define __cpp_lib_void_t 201411L
// also in <type_traits> 
// also in <type_traits> 
// also in <exception>
// also in <unordered_map> 
// also in <utility>
// also in <type_traits> 
// also in <variant>
// also in <type_traits>
int main(){
  cout  <<  n4910 << endl;
  return EXIT_SUCCESS;
}

Script

clgc.sh
#!/bin/sh
rm $1l
rm $1g
echo "$ clang++ $1.cpp -std=03 -o $1l -I. -Wall" 
clang++ $1.cpp -std=c++03 -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l 
fi
rm $1l
echo "$ clang++ $1.cpp -std=2b -o $1l -I. -Wall"
clang++ $1.cpp -std=c++2b -o $1l -I. -Wall
if [  -e $1l ]; then
./$1l
fi
echo "\r"
echo "$ g++ $1.cpp -std=03 -o $1g -I. -Wall"
g++ $1.cpp -std=c++03 -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g
fi
rm $1g
echo "\r"
echo "$ g++ $1.cpp -std=2b -o $1g -I. -Wall"
g++ $1.cpp -std=c++2b -o $1g -I. -Wall
if [ -e $1g ]; then
./$1g 
fi

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

bash
# ./clgc.sh p499
$ clang++ p499.cpp -std=c++03 -o p499l -I. -Wall
In file included from p499.cpp:19:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: 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 \
 ^
p499.cpp:97:9: warning: '__cpp_lib_incomplete_container_elements' macro redefined [-Wmacro-redefined]
#define __cpp_lib_incomplete_container_elements 201505L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/allocator.h:52:9: note: previous definition is here
#define __cpp_lib_incomplete_container_elements 201505
        ^
1 warning and 1 error generated.
rm: cannot remove 'p499l': No such file or directory
$ clang++ p499.cpp -std=c++2b -o p499l -I. -Wall
p499.cpp:26:9: warning: '__cpp_lib_addressof_constexpr' macro redefined [-Wmacro-redefined]
#define __cpp_lib_addressof_constexpr  201603L // also in <memory> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/move.h:129:10: note: previous definition is here
# define __cpp_lib_addressof_constexpr 201603
         ^
p499.cpp:28:9: warning: '__cpp_lib_allocator_traits_is_always_equal' macro redefined [-Wmacro-redefined]
#define __cpp_lib_allocator_traits_is_always_equal  201411L // also in <memory>, <scoped_allocator>, <string>, <deque>, <forward_list>, <list>, <vector>, 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:46:9: note: previous definition is here
#define __cpp_lib_allocator_traits_is_always_equal 201411
        ^
p499.cpp:32:9: warning: '__cpp_lib_apply' macro redefined [-Wmacro-redefined]
#define __cpp_lib_apply 201603L // also in <tuple>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1717:10: note: previous definition is here
# define __cpp_lib_apply 201603
         ^
p499.cpp:34:9: warning: '__cpp_lib_as_const' macro redefined [-Wmacro-redefined]
#define __cpp_lib_as_const 201510L // also in <utility>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/utility:393:10: note: previous definition is here
#define  __cpp_lib_as_const 201510
         ^
p499.cpp:39:9: warning: '__cpp_lib_atomic_is_always_lock_free' macro redefined [-Wmacro-redefined]
#define __cpp_lib_atomic_is_always_lock_free  201603L // also in <atomic>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:53:10: note: previous definition is here
# define __cpp_lib_atomic_is_always_lock_free 201603
         ^
p499.cpp:50:9: warning: '__cpp_lib_bool_constant' macro redefined [-Wmacro-redefined]
#define __cpp_lib_bool_constant 201505L // also in <type_traits> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:84:10: note: previous definition is here
# define __cpp_lib_bool_constant 201505
         ^
p499.cpp:59:9: warning: '__cpp_lib_clamp' macro redefined [-Wmacro-redefined]
#define __cpp_lib_clamp 201603L // also in <algorithm> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:3663:9: note: previous definition is here
#define __cpp_lib_clamp 201603
        ^
p499.cpp:60:9: warning: '__cpp_lib_complex_udls' macro redefined [-Wmacro-redefined]
#define __cpp_lib_complex_udls 201309L // also in <complex>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/complex:1983:9: note: previous definition is here
#define __cpp_lib_complex_udls 201309
        ^
p499.cpp:68:9: warning: '__cpp_lib_constexpr_memory' macro redefined [-Wmacro-redefined]
#define __cpp_lib_constexpr_memory 202202L // also in <memory> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/ptr_traits.h:38:9: note: previous definition is here
#define __cpp_lib_constexpr_memory 201811L
        ^
p499.cpp:82:9: warning: '__cpp_lib_erase_if' macro redefined [-Wmacro-redefined]
#define __cpp_lib_erase_if 201907L // also in <bit> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/erase_if.h:42:10: note: previous definition is here
# define __cpp_lib_erase_if 202002L
         ^
p499.cpp:85:9: warning: '__cpp_lib_exchange_function' macro redefined [-Wmacro-redefined]
#define __cpp_lib_exchange_function  201304L // also in <utility> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/utility:285:9: note: previous definition is here
#define __cpp_lib_exchange_function 201304
        ^
p499.cpp:91:9: warning: '__cpp_lib_generic_associative_lookup' macro redefined [-Wmacro-redefined]
#define __cpp_lib_generic_associative_lookup  201304L // also in <map>, <set> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_tree.h:80:10: note: previous definition is here
# define __cpp_lib_generic_associative_lookup 201304
         ^
p499.cpp:95:9: warning: '__cpp_lib_has_unique_object_representations' macro redefined [-Wmacro-redefined]
#define __cpp_lib_has_unique_object_representations 201606L // also in <type_traits> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:3193:10: note: previous definition is here
# define __cpp_lib_has_unique_object_representations 201606
         ^
p499.cpp:96:9: warning: '__cpp_lib_hypot' macro redefined [-Wmacro-redefined]
#define __cpp_lib_hypot 201603L // also in <cmath> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cmath:1850:9: note: previous definition is here
#define __cpp_lib_hypot 201603
        ^
p499.cpp:97:9: warning: '__cpp_lib_incomplete_container_elements' macro redefined [-Wmacro-redefined]
#define __cpp_lib_incomplete_container_elements 201505L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/allocator.h:52:9: note: previous definition is here
#define __cpp_lib_incomplete_container_elements 201505
        ^
p499.cpp:101:9: warning: '__cpp_lib_integer_sequence' macro redefined [-Wmacro-redefined]
#define __cpp_lib_integer_sequence 201304L // also in <utility>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/utility:322:9: note: previous definition is here
#define __cpp_lib_integer_sequence 201304
        ^
p499.cpp:102:9: warning: '__cpp_lib_integral_constant_callable' macro redefined [-Wmacro-redefined]
#define __cpp_lib_integral_constant_callable  201304L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:65:9: note: previous definition is here
#define __cpp_lib_integral_constant_callable 201304
        ^
p499.cpp:106:9: warning: '__cpp_lib_is_aggregate' macro redefined [-Wmacro-redefined]
#define __cpp_lib_is_aggregate 201703L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:3211:10: note: previous definition is here
# define __cpp_lib_is_aggregate 201703
         ^
p499.cpp:109:9: warning: '__cpp_lib_is_invocable' macro redefined [-Wmacro-redefined]
#define __cpp_lib_is_invocable 201703L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:2947:10: note: previous definition is here
# define __cpp_lib_is_invocable 201703
         ^
p499.cpp:112:9: warning: '__cpp_lib_is_null_pointer' macro redefined [-Wmacro-redefined]
#define __cpp_lib_is_null_pointer 201309L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:501:9: note: previous definition is here
#define __cpp_lib_is_null_pointer 201309
        ^
p499.cpp:115:9: warning: '__cpp_lib_is_swappable' macro redefined [-Wmacro-redefined]
#define __cpp_lib_is_swappable 201603L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:2715:9: note: previous definition is here
#define __cpp_lib_is_swappable 201603
        ^
p499.cpp:118:9: warning: '__cpp_lib_launder' macro redefined [-Wmacro-redefined]
#define __cpp_lib_launder 201806L // also in <forward_list>, <list> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/new:189:9: note: previous definition is here
#define __cpp_lib_launder 201606
        ^
p499.cpp:120:9: warning: '__cpp_lib_logical_traits' macro redefined [-Wmacro-redefined]
#define __cpp_lib_logical_traits 201606L // also in <tuple>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:159:9: note: previous definition is here
#define __cpp_lib_logical_traits 201510
        ^
p499.cpp:121:9: warning: '__cpp_lib_make_from_tuple' macro redefined [-Wmacro-redefined]
#define __cpp_lib_make_from_tuple
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1739:9: note: previous definition is here
#define __cpp_lib_make_from_tuple  201606
        ^
p499.cpp:122:9: warning: '__cpp_lib_make_reverse_iterator' macro redefined [-Wmacro-redefined]
#define __cpp_lib_make_reverse_iterator  201402L // also in <iterator> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:545:11: note: previous definition is here
#  define __cpp_lib_make_reverse_iterator 201402
          ^
p499.cpp:124:9: warning: '__cpp_lib_map_try_emplace' macro redefined [-Wmacro-redefined]
#define __cpp_lib_map_try_emplace  201411L // also in <map>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_map.h:668:9: note: previous definition is here
#define __cpp_lib_map_try_emplace 201411
        ^
p499.cpp:129:9: warning: '__cpp_lib_node_extract' macro redefined [-Wmacro-redefined]
#define __cpp_lib_node_extract 201606L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/node_handle.h:37:10: note: previous definition is here
# define __cpp_lib_node_extract 201606
         ^
p499.cpp:131:9: warning: '__cpp_lib_nonmember_container_access' macro redefined [-Wmacro-redefined]
#define __cpp_lib_nonmember_container_access   201411L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/range_access.h:237:9: note: previous definition is here
#define __cpp_lib_nonmember_container_access 201411
        ^
p499.cpp:136:9: warning: '__cpp_lib_optional' macro redefined [-Wmacro-redefined]
#define __cpp_lib_optional 202110L // also in <optional>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/optional:57:9: note: previous definition is here
#define __cpp_lib_optional 201606L
        ^
p499.cpp:141:9: warning: '__cpp_lib_ranges' macro redefined [-Wmacro-redefined]
#define __cpp_lib_ranges 202202L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/range_cmp.h:59:9: note: previous definition is here
#define __cpp_lib_ranges 201911L
        ^
p499.cpp:154:9: warning: '__cpp_lib_result_of_sfinae' macro redefined [-Wmacro-redefined]
#define __cpp_lib_result_of_sfinae 201210L // also in <functional>, <type_traits> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:2348:9: note: previous definition is here
#define __cpp_lib_result_of_sfinae 201210
        ^
p499.cpp:155:9: warning: '__cpp_lib_robust_nonmodifying_seq_ops' macro redefined [-Wmacro-redefined]
#define __cpp_lib_robust_nonmodifying_seq_ops 201304L // also in <algorithm>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:1507:9: note: previous definition is here
#define __cpp_lib_robust_nonmodifying_seq_ops 201304
        ^
p499.cpp:156:9: warning: '__cpp_lib_sample' macro redefined [-Wmacro-redefined]
#define __cpp_lib_sample 201603L // also in <algorithm>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:5854:9: note: previous definition is here
#define __cpp_lib_sample 201603
        ^
p499.cpp:174:9: warning: '__cpp_lib_string_udls' macro redefined [-Wmacro-redefined]
#define __cpp_lib_string_udls 201304L // also in <string>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:6887:9: note: previous definition is here
#define __cpp_lib_string_udls 201304
        ^
p499.cpp:182:9: warning: '__cpp_lib_transformation_trait_aliases' macro redefined [-Wmacro-redefined]
#define __cpp_lib_transformation_trait_aliases  201304L // also in <type_traits>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:1562:9: note: previous definition is here
#define __cpp_lib_transformation_trait_aliases 201304
        ^
p499.cpp:183:9: warning: '__cpp_lib_transparent_operators' macro redefined [-Wmacro-redefined]
#define __cpp_lib_transparent_operators 201510L // also in <memory>, <functional> 
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_function.h:227:9: note: previous definition is here
#define __cpp_lib_transparent_operators 201510
        ^
p499.cpp:185:9: warning: '__cpp_lib_tuples_by_type' macro redefined [-Wmacro-redefined]
#define __cpp_lib_tuples_by_type 201304L // also in <utility>, <tuple>
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1323:9: note: previous definition is here
#define __cpp_lib_tuples_by_type 201304
        ^
p499.cpp:189:9: warning: '__cpp_lib_unordered_map_try_emplace' macro redefined [-Wmacro-redefined]
#define __cpp_lib_unordered_map_try_emplace  201411L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:445:9: note: previous definition is here
#define __cpp_lib_unordered_map_try_emplace 201411
        ^
p499.cpp:193:9: warning: '__cpp_lib_void_t' macro redefined [-Wmacro-redefined]
#define __cpp_lib_void_t 201411L
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:2574:9: note: previous definition is here
#define __cpp_lib_void_t 201411
        ^
39 warnings generated.
17.3.2 Header <version> synopsis [version.syn] C++N4910:2022 (270) p499.cpp

$ g++ p499.cpp -std=c++03 -o p499g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from p499.cpp:19:
/usr/local/include/c++/12.1.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.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
rm: cannot remove 'p499g': No such file or directory

$ g++ p499.cpp -std=c++2b -o p499g -I. -Wall
p499.cpp:68: warning: "__cpp_lib_constexpr_memory" redefined
   68 | #define __cpp_lib_constexpr_memory 202202L // also in <memory>
      | 
In file included from /usr/local/include/c++/12.1.0/bits/iterator_concepts.h:36,
                 from /usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:71,
                 from /usr/local/include/c++/12.1.0/bits/stl_construct.h:61,
                 from /usr/local/include/c++/12.1.0/bits/char_traits.h:46,
                 from /usr/local/include/c++/12.1.0/ios:40,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from p499.cpp:10:
/usr/local/include/c++/12.1.0/bits/ptr_traits.h:41: note: this is the location of the previous definition
   41 | #  define __cpp_lib_constexpr_memory 201811L
      | 
p499.cpp:82: warning: "__cpp_lib_erase_if" redefined
   82 | #define __cpp_lib_erase_if 201907L // also in <bit>
      | 
In file included from /usr/local/include/c++/12.1.0/map:64,
                 from p499.cpp:18:
/usr/local/include/c++/12.1.0/bits/erase_if.h:44: note: this is the location of the previous definition
   44 | # define __cpp_lib_erase_if 202002L
      | 
p499.cpp:118: warning: "__cpp_lib_launder" redefined
  118 | #define __cpp_lib_launder 201806L // also in <forward_list>, <list>
      | 
In file included from /usr/local/include/c++/12.1.0/bits/exception_ptr.h:40,
                 from /usr/local/include/c++/12.1.0/exception:168,
                 from /usr/local/include/c++/12.1.0/ios:39:
/usr/local/include/c++/12.1.0/new:189: note: this is the location of the previous definition
  189 | #define __cpp_lib_launder 201606L
      | 
p499.cpp:120: warning: "__cpp_lib_logical_traits" redefined
  120 | #define __cpp_lib_logical_traits 201606L // also in <tuple>
      | 
In file included from /usr/local/include/c++/12.1.0/bits/move.h:57,
                 from /usr/local/include/c++/12.1.0/bits/exception_ptr.h:43:
/usr/local/include/c++/12.1.0/type_traits:191: note: this is the location of the previous definition
  191 | #define __cpp_lib_logical_traits 201510L
      | 
p499.cpp:121: warning: "__cpp_lib_make_from_tuple" redefined
  121 | #define __cpp_lib_make_from_tuple
      | 
In file included from /usr/local/include/c++/12.1.0/bits/stl_map.h:63,
                 from /usr/local/include/c++/12.1.0/map:61:
/usr/local/include/c++/12.1.0/tuple:1868: note: this is the location of the previous definition
 1868 | #define __cpp_lib_make_from_tuple  201606L
      | 
p499.cpp:141: warning: "__cpp_lib_ranges" redefined
  141 | #define __cpp_lib_ranges 202202L
      | 
In file included from /usr/local/include/c++/12.1.0/bits/iterator_concepts.h:37:
/usr/local/include/c++/12.1.0/bits/ranges_cmp.h:60: note: this is the location of the previous definition
   60 | #define __cpp_lib_ranges 202110L
      | 
17.3.2 Header <version> synopsis [version.syn] C++N4910:2022 (270) p499.cpp

検討事項(agenda)

意味のある出力。

参考資料(reference)

cpprefjp - C++日本語リファレンス

コンパイラの実装状況

typedef は C++11 ではオワコン

C99からC++14を駆け抜けるC++講座

自己参照(self reference)

コピペコンパイルエラーあるある

C++ Error Message Collection(1)does not name a type, 11 articles

dockerにclang

docker gnu(gcc/g++) and llvm(clang/clang++)

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015

C++ sample list

clang++, g++コンパイルエラー方針の違いの例

astyle 使ってみた

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

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.01 初稿  20220708

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?