https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104098
Bug ID: 104098 Summary: bits/stl_iterator.h fails to compile for __cplusplus > 201703L but with __cpp_concepts undefined Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: richard.corden at gmail dot com Target Milestone: --- Hi, The following commit changed a preprocessor condition, removing a check for __cpp_lib_concepts: https://github.com/gcc-mirror/gcc/commit/d5cbe0f0d4b7bc11f80b2236521f90ec94e95767#diff-d1fe6b9164baa7e8e1119a4d194b6b2481439be0cdf5da5794e8001537db4e84 The result being that this header cannot be used with __cplusplus after 201703L unless "__cpp_concepts" is defined. Compiling the following with "g++ -std=c++20 sample.cpp" reproduces the issue: {code:c++} // sample.cpp #undef __cpp_concepts #include <vector> {code} {noformat} > g++-11 -std=c++20 sample.cpp In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from sample.cpp:3: /usr/include/c++/11/bits/stl_iterator.h:158:25: error: ‘random_access_iterator’ was not declared in this scope; did you mean ‘random_access_iterator_tag’? 158 | = conditional_t<random_access_iterator<_Iterator>, | ^~~~~~~~~~~~~~~~~~~~~~ | random_access_iterator_tag /usr/include/c++/11/bits/stl_iterator.h:158:57: error: wrong number of template arguments (1, should be 3) 158 | = conditional_t<random_access_iterator<_Iterator>, | ^ In file included from /usr/include/c++/11/bits/move.h:57, from /usr/include/c++/11/bits/stl_pair.h:59, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/vector:60, from sample.cpp:3: {noformat} The following addresses the issue for me locally: {code:c++} #if __cplusplus <= 201703L || ! defined (__cpp_lib_concepts) {code} Cheers, Richard