https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91383
Bug ID: 91383
Summary: C++17 should remove some library feature deprecated in
C++14
Product: gcc
Version: 9.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ufospoke at gmail dot com
Target Milestone: ---
Created attachment 46679
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46679&action=edit
program showing that removed features still compile with c++17 and g++ 9.1.0
auto_ptr, unary_function, binary_function, random_shuffle, ptr_fun, mem_fun,
mem_fun_ref, bind1st and bind2nd have been removed from C++17 but they still
compile with g++ 9.1.0.
Appendix C.4.12 of the draft C++17 standard entitled "Annex D: compatibility
features" says:
"Change: The class templates auto_ptr, unary_function, and binary_function, the
function templates
random_shuffle, and the function templates (and their return types) ptr_fun,
mem_fun, mem_fun_ref,
bind1st, and bind2nd are not defined.
Rationale: Superseded by new features.
Effect on original feature: Valid C ++ 2014 code that uses these class
templates and function templates
may fail to compile in this International Standard."
However
g++-9.1.0 -Wall -Wextra -std=c++17 removed.cpp
normally compiles the attached program with the following warnings:
removed.cpp: In function 'int main()':
removed.cpp:13:10: warning: 'template<class> class std::auto_ptr' is deprecated
[-Wdeprecated-declarations]
13 | std::auto_ptr<int> p{new int};
| ^~~~~~~~
In file included from /softs/gcc-9.1.0/include/c++/9.1.0/memory:80,
from removed.cpp:5:
/softs/gcc-9.1.0/include/c++/9.1.0/bits/unique_ptr.h:53:28: note: declared here
53 | template<typename> class auto_ptr;
| ^~~~~~~~
removed.cpp:35:24: warning: comparison of integer expressions of different
signedness: 'int' and 'std::array<int, 5>::size_type' {aka 'long unsigned int'}
[-Wsign-compare]
35 | for (auto i = 0; i < v.size(); ++i) {
| ~~^~~~~~~~~~
and following output:
* auto_ptr
12
* unary_function
1
* binary_function
0
* random_shuffle
4:3:1:2:0
* ptr_fun
42
* mem_fun
3
* mem_fun_ref
4
* bind1st
12
* bind2nd
12