Bug 272654 - The feature std::binary_function that has to be removed in C++17 isn't removed in clang-15 in FreeBSD 13.2 STABLE
Summary: The feature std::binary_function that has to be removed in C++17 isn't remove...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-22 08:53 UTC by Yuri Victorovich
Modified: 2023-07-22 11:06 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2023-07-22 08:53:36 UTC
This code:
> #include <functional>
> 
> class X : public std::binary_function<int,int,int> {
> };

succeeds when compiled with --std=c++17, despite the C++ standard requiring it to be removed in C++17:
https://en.cppreference.com/w/cpp/utility/functional/binary_function
Comment 1 Mark Millard 2023-07-22 11:06:51 UTC
(In reply to Yuri Victorovich from comment #0)

This is a misinterpretation of what removal from the language means. I'll
just quote an old Microsoft blog post:

https://devblogs.microsoft.com/cppblog/c17-feature-removals-and-deprecations/

says:

"Technically, even removal isn’t the end of the road for a feature. Implementations can conform to C++17, yet accept features that were removed in C++17, as an extension. For example, the STL’s Standardese has a “Zombie names” section, saying that “In namespace std, the following names are reserved for previous standardization”. Essentially, C++17 is saying that while it doesn’t specify auto_ptr or unary_function or so forth, conformant C++17 programs aren’t allowed to interfere with such names (e.g. with macros), so that conformant C++17 STL implementations can provide auto_ptr/etc. as a non-C++17-Standard extension. This allows implementers to choose whether they physically remove features, and additionally makes it easier for the Committee to remove features from the Standard."