BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bsls_compilerfeatures.h
Go to the documentation of this file.
1/// @file bsls_compilerfeatures.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bsls_compilerfeatures.h -*-C++-*-
8#ifndef INCLUDED_BSLS_COMPILERFEATURES
9#define INCLUDED_BSLS_COMPILERFEATURES
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bsls_compilerfeatures bsls_compilerfeatures
15/// @brief Provide macros to identify compiler support for C++11 features.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bsls
19/// @{
20/// @addtogroup bsls_compilerfeatures
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bsls_compilerfeatures-purpose"> Purpose</a>
25/// * <a href="#bsls_compilerfeatures-macros"> Macros </a>
26/// * <a href="#bsls_compilerfeatures-description"> Description </a>
27/// * <a href="#bsls_compilerfeatures-binary-macros"> Binary Macros </a>
28/// * <a href="#bsls_compilerfeatures-meaning-of-platform-specific-macros"> Meaning of Platform Specific Macros </a>
29/// * <a href="#bsls_compilerfeatures-darwin"> Darwin </a>
30/// * <a href="#bsls_compilerfeatures-macro-summary"> Macro Summary </a>
31/// * <a href="#bsls_compilerfeatures-usage"> Usage </a>
32/// * <a href="#bsls_compilerfeatures-example-1-using-bsls_compilerfeatures_support_extern_template"> Example 1: Using BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE </a>
33/// * <a href="#bsls_compilerfeatures-example-2-__line__-macro-multi-line-value-differences-demonstration"> Example 2: __LINE__ Macro Multi-line Value Differences Demonstration </a>
34/// * <a href="#bsls_compilerfeatures-bugs-in-compilers"> Bugs in Compilers </a>
35/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_initializer_list_leaks_on_exceptions"> BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS </a>
36/// * <a href="#bsls_compilerfeatures-feature-support-in-compilers"> Feature Support in Compilers </a>
37/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp11"> BSLS_COMPILERFEATURES_FULL_CPP11 </a>
38/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp14"> BSLS_COMPILERFEATURES_FULL_CPP14 </a>
39/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp17"> BSLS_COMPILERFEATURES_FULL_CPP17 </a>
40/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp20"> BSLS_COMPILERFEATURES_FULL_CPP20 </a>
41/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_pp_line_is_on_first"> BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST </a>
42/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_alias_templates"> BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES </a>
43/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_alignas"> BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS </a>
44/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_noreturn"> BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN </a>
45/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_nodiscard"> BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD </a>
46/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_fallthrough"> BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH </a>
47/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_maybe_unused"> BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED </a>
48/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_concepts"> BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS </a>
49/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr"> BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR </a>
50/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr_cpp14"> BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14 </a>
51/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr_cpp17"> BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17 </a>
52/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_coroutine"> BSLS_COMPILERFEATURES_SUPPORT_COROUTINE </a>
53/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_decltype"> BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE </a>
54/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_default_template_args"> BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS </a>
55/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_defaulted_functions"> BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS </a>
56/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_deleted_functions"> BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS </a>
57/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_enum_class"> BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS </a>
58/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_extern_template"> BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE </a>
59/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_final"> BSLS_COMPILERFEATURES_SUPPORT_FINAL </a>
60/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_generalized_initializers"> BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS </a>
61/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_has_include"> BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE </a>
62/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_include_next"> BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT </a>
63/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_inline_namespace"> BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE </a>
64/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_inline_variables"> BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES </a>
65/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_noexcept"> BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT </a>
66/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_nullptr"> BSLS_COMPILERFEATURES_SUPPORT_NULLPTR </a>
67/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_operator_explicit"> BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT </a>
68/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_override"> BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE </a>
69/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_raw_strings"> BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS </a>
70/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_ref_qualifiers"> BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS </a>
71/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_rvalue_references"> BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES </a>
72/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_static_assert"> BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT </a>
73/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_static_call_operator"> BSLS_COMPILERFEATURES_SUPPORT_STATIC_CALL_OPERATOR </a>
74/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_three_way_comparison"> BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON </a>
75/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_variadic_templates"> BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES </a>
76/// * <a href="#bsls_compilerfeatures-bsls_compilerfeatures_support_variable_templates"> BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES </a>
77/// * <a href="#bsls_compilerfeatures-microsoft-visual-studio-versions-mapping"> Microsoft Visual Studio versions mapping </a>
78///
79/// # Purpose {#bsls_compilerfeatures-purpose}
80/// Provide macros to identify compiler support for C++11 features.
81///
82/// # Macros {#bsls_compilerfeatures-macros}
83///
84/// - BSLS_COMPILERFEATURES_CPLUSPLUS: portable version of `__cplusplus`
85/// - BSLS_COMPILERFEATURES_FORWARD_REF(T): argument of type `T` to be forwarded
86/// - BSLS_COMPILERFEATURES_FORWARD(T, V): forward argument `V` of type `T`
87/// - BSLS_COMPILERFEATURES_FULL_CPP11: indicates all c++11 features available
88/// - BSLS_COMPILERFEATURES_FULL_CPP14: indicates all c++14 features available
89/// - BSLS_COMPILERFEATURES_FULL_CPP17: indicates all c++17 features available
90/// - BSLS_COMPILERFEATURES_FULL_CPP20: indicates all c++20 features available
91/// - BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION: flag for return optimization
92/// - BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS: compiler bug
93/// - BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST: `__LINE__` value for multi-line
94/// - BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES: flag for alias templates
95/// - BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS: flag for `alignas`
96/// - BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH: `[[fallthrough]]`
97/// - BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED: `[[maybe_unused]]`
98/// - BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD: `[[nodiscard]]`
99/// - BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN: `[[noreturn]]` attribute
100/// - BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS: C++20 core language concepts
101/// - BSLS_COMPILERFEATURES_SUPPORT_CONSTEVAL_CPP20: `consteval` specifier
102/// - BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR: `constexpr` specifier
103/// - BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14: C++14 `constexpr` spec.
104/// - BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17: C++17 `constexpr` spec.
105/// - BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP20: C++20 'constexpr' spec.
106/// - BSLS_COMPILERFEATURES_SUPPORT_COROUTINE: core & lib C++20 coroutine support
107/// - BSLS_COMPILERFEATURES_SUPPORT_CTAD: flag for template argument deduction
108/// - BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE: flag for `decltype`
109/// - BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS: for function templates
110/// - BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS: explicit `= default`
111/// - BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS: explicit `= deleted`
112/// - BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS: flag for `enum class`
113/// - BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE: flag for `extern template`
114/// - BSLS_COMPILERFEATURES_SUPPORT_FINAL: flag for `final` keyword
115/// - BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS: init.-list syntax
116/// - BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE: flag for `__has_include`
117/// - BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS: `0x1.5p+5` supported
118/// - BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT: flag for @ref include_next
119/// - BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE: flag for `inline namespace`
120/// - BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES: flag for `inline` variables
121/// - BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT: `noexcept` operator
122/// - BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE: `noexcept` fnctype diff
123/// - BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_TYPES: deprecated, see above
124/// - BSLS_COMPILERFEATURES_SUPPORT_NULLPTR: flag for `nullptr`
125/// - BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT: `explicit` operator
126/// - BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE: `override` keyword
127/// - BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS: C++11-style R"tag(string)tag"
128/// - BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS: ref-qualified member function
129/// - BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES: flag for rvalue references
130/// - BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT: flag for @ref static_assert
131/// - BSLS_COMPILERFEATURES_SUPPORT_STATIC_CALL_OPERATOR: `static operator()`
132/// - BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON: `<=>` operator
133/// - BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS: C++98 exception specs.
134/// - BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER: has `<type_traits>` header
135/// - BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES: flag for `char(16|32)_t`
136/// - BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS: user-defined literals
137/// - BSLS_COMPILERFEATURES_SUPPORT_UTF8_CHAR_TYPE: flag for `char8_t`
138/// - BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES: variable templates flag
139/// - BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES: flag for variadic params.
140///
141/// @see bsls_libraryfeatures, bsls_platform
142///
143/// # Description {#bsls_compilerfeatures-description}
144/// This component provides a suite of preprocessor macros to
145/// identify compiler-specific support of language features that may not be
146/// available on all compilers in use across an organization. For example, as
147/// post-classic (C++11 and beyond) language facilities become more broadly
148/// available with sufficient quality (such as `extern template`) macros will be
149/// defined here to indicate whether the current platform/compiler combination
150/// supports the corresponding language features. Note that in some cases,
151/// support for a given feature may need to be explicitly enabled by using an
152/// appropriate compiler command-line option.
153///
154/// ## Binary Macros {#bsls_compilerfeatures-binary-macros}
155///
156///
157/// Binary macros defined in this file (such as the
158/// `BSLS_COMPILERFEATURES_SUPPORT_*` macros, and the
159/// `BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS`, and the
160/// `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST` macros) that represents a
161/// true/false preprocessor value are either undefined or defined to be the
162/// integer value 1. This allows the traditional, idiomatic use of these macros
163/// where more brief preprocessor conditions rely on the fact that the C and C++
164/// preprocessors replace these unknown tokens with the value 0 in conditions:
165/// The following short condition
166/// @code
167/// #if BSLS_COMPILERFEATURES_SUPPORT_CTAD && /
168/// BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
169/// #define U_TAKE_MY_FINAL_FORM 1
170/// #endif
171/// @endcode
172/// works identical to the following, longer one.
173/// @code
174/// #if defined(BSLS_COMPILERFEATURES_SUPPORT_CTAD) && /
175/// defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES)
176/// #define U_TAKE_MY_FINAL_FORM 1
177/// #endif
178/// @endcode
179/// Note that the line continuation backslash has been replaced with `/` to
180/// silence "multiline comment" warnings.
181///
182/// ## Meaning of Platform Specific Macros {#bsls_compilerfeatures-meaning-of-platform-specific-macros}
183///
184///
185/// In this section we discuss the meaning of predefined platforms-specific
186/// macros where documentation is lacking or hard to find.
187///
188/// ### Darwin {#bsls_compilerfeatures-darwin}
189///
190///
191/// Darwin has two compiler-relevant macros but much code often uses only one:
192/// `__APPLE_CC__` for both purposes. This clarification is placed here so that
193/// we don't make the same mistake.
194///
195/// * `__APPLE_CC__`: when defined it indicates that the *platform* to which we
196/// compile is Darwin. It does *not* mean that the compiler is made by Apple,
197/// it is defined in 3rd party GCC or LLVM builds as well. It identifies the
198/// target operating system. (Note that the value of this macro does not seem
199/// to ever be larger than 6000.)
200///
201/// * `__apple_build_version__`: when defined it indicates that the
202/// (clang/clang++) compiler compiling the code is the one built by Apple. It
203/// will not be defined on 3rd party LLVM builds (such as those by brew.sh, or
204/// MacPorts, or built-from-source).
205///
206/// ## Macro Summary {#bsls_compilerfeatures-macro-summary}
207///
208///
209/// The following are the macros provided by this component. Note that they are
210/// not defined for all platform/compiler combinations.
211///
212/// * `BSLS_COMPILERFEATURES_CPLUSPLUS`
213/// > This macro provides a portable way to determine the version of the C++
214/// > standard mode that is being used. In general, this has the same value
215/// > as the standard `__cplusplus` macro, but on some compilers with some
216/// > settings the standard macro does not get assigned the correct value.
217/// > The values generally set (as defined in the C++ Standard) are the year
218/// > and month when the Standard was completed, and the value of this macro
219/// > should be compared with the appropriate constants:
220/// > - 199711L -- before C++11
221/// > - 201103L -- C++11
222/// > - 201402L -- C++14
223/// > - 201703L -- C++17
224/// > - 202002L -- C++20
225/// > - 202302L -- C++23
226/// > Note that compilers may report "in-between" values to indicate partial
227/// > support of a standard, so `BSLS_COMPILERFEATURES_CPLUSPLUS > 201402L`
228/// > normally means that *some* C++17 features are available. Since those
229/// > values are not standardized their meaning varies.
230///
231/// * `BSLS_COMPILERFEATURES_FORWARD_REF(T)`
232/// > This macro provides a portable way to declare a function template
233/// > argument of type `T` that is to be perfect-forwarded. The expansion of
234/// > the macro will use syntax that is appropriate for the current compiler
235/// > settings for this platform.
236///
237/// * `BSLS_COMPILERFEATURES_FORWARD(T, V)`
238/// > This macro provides a portable way to perfect-forward a function
239/// > template argument, `V`, of type `T`. The expansion of the macro will
240/// > use syntax that is appropriate for the current compiler settings for
241/// > this platform. Note that due to the vagaries of implementing this
242/// > macro, client code using this macro should provide the following two
243/// > inclusions (in addition to the requisite inclusion of this header):
244/// > - `#include <bslmf_util.h>`
245/// > - `#include <bsls_util.h>`
246///
247/// * `BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION`
248/// > This macro is defined if the compiler always elides all copies (or
249/// > moves) when returning a prvalue expression from a function and using
250/// > that expression to initialize a class object of the same type
251/// > (ignoring cv qualifications). Specifically, given the function,
252/// > `Thing funcReturningThing() { return Thing(ctor-args...); }`, the
253/// > return value is always initialized with `(ctor-args...)`; no copy is
254/// > performed in the return statement. Additionally,
255/// > `Thing var(funcReturningThing())` always constructs `var` directly
256/// > from the return expression of `funcReturningThing()`; again, no copies
257/// > are involved. The semantics of these optimizations are guaranteed in
258/// > C++17 and later, but are optional in previous versions of C++.
259///
260/// * `BSLS_COMPILERFEATURES_FULL_CPP11`
261/// > This macro is defined if the compiler supports all C++11 feature
262/// > macros, and any other C++11 feature not described by the feature macros
263/// > in this component. If this macro is defined, code can assume that all
264/// > C++11 feature macros are defined if this macro is defined. Note that
265/// > any component that relies on this macro will be incompatible with older
266/// > compiler versions that do not define it.
267/// > The list of C++11 feature macros is:
268/// >..
269/// > BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
270/// > BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS
271/// > BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN
272/// > BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR
273/// > BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE
274/// > BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS
275/// > BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS
276/// > BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS
277/// > BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS
278/// > BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE
279/// > BSLS_COMPILERFEATURES_SUPPORT_FINAL
280/// > BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS
281/// > BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE
282/// > BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT
283/// > BSLS_COMPILERFEATURES_SUPPORT_NULLPTR
284/// > BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
285/// > BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE
286/// > BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS
287/// > BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
288/// > BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
289/// > BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT
290/// > BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER
291/// > BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES
292/// > BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS
293/// > BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
294/// >..
295///
296/// * `BSLS_COMPILERFEATURES_FULL_CPP14`
297/// > This macro is defined if the compiler supports all C++14 feature
298/// > macros, and any other C++14 feature not described by the feature macros
299/// > in this component. If this macro is defined, code can assume that all
300/// > C++14 feature macros are defined if this macro is defined. Note that
301/// > any component that relies on this macro will be incompatible with older
302/// > compiler versions that do not define it.
303/// > The list of C++14 feature macros is:
304/// >..
305/// > BSLS_COMPILERFEATURES_FULL_CPP11
306/// > BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14
307/// > BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
308/// >..
309///
310/// * `BSLS_COMPILERFEATURES_FULL_CPP17`
311/// > This macro is defined if the compiler supports all C++17 feature
312/// > macros, and any other C++17 feature not described by the feature macros
313/// > in this component. If this macro is defined, code can assume that all
314/// > C++17 feature macros are defined if this macro is defined. Note that
315/// > any component that relies on this macro will be incompatible with older
316/// > compiler versions that do not define it.
317/// > The list of C++17 feature macros is:
318/// >..
319/// > BSLS_COMPILERFEATURES_FULL_CPP14
320/// > BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH
321/// > BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED
322/// > BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD
323/// > BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17
324/// > BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE
325/// > BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
326/// > BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES
327/// > BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE
328/// > BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_TYPES
329/// >..
330///
331/// * `BSLS_COMPILERFEATURES_FULL_CPP20`
332/// > This macro is defined if, with the exception of modules, the compiler
333/// > supports all C++20 feature macros, and any other C++20 feature not
334/// > described by the feature macros in this component. If this macro is
335/// > defined, code can assume that all C++20 feature macros are defined.
336/// > Support for modules can be determined independently of this macro by
337/// > testing the standard feature test macro instead, `__cpp_modules`.
338/// > Note that components relying on the `BSLS_COMPILERFEATURES_FULL_CPP20`
339/// > macro will be incompatible with older compiler versions that do not
340/// > define it.
341/// > The list of C++20 feature macros is:
342/// >..
343/// > BSLS_COMPILERFEATURES_FULL_CPP17
344/// > BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS
345/// > BSLS_COMPILERFEATURES_SUPPORT_CONSTEVAL_CPP20
346/// > BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP20
347/// > BSLS_COMPILERFEATURES_SUPPORT_COROUTINE
348/// > BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
349/// > BSLS_COMPILERFEATURES_SUPPORT_UTF8_CHAR_TYPE
350/// >..
351///
352/// * `BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS`
353/// > The `BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS` macro
354/// > is defined for implementations that leak temporary objects constructed
355/// > trying to initialize a `std::initializer_list` object in the event that
356/// > one of the elements of the list throws from its constructor. This is
357/// > known to affect gcc as recently as the 8.x series, and the Sun CC
358/// > compiler in C++11 mode. This would often reveal itself as a spurious
359/// > memory leak in exception-safety tests for @ref initializer_list
360/// > constructors, so rises to the level of a generally supported
361/// > defect-detection macro.
362///
363/// * `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST`
364/// > The `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST` macro is defined for
365/// > implementations that implement WG14 N2322
366/// > (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2322.htm)
367/// > "Recommended practice" on the substitution value for the `__LINE__`
368/// > (predefined) preprocessor macro when expanding a macro that uses
369/// > `__LINE__` in its body, and that macro invocation spans multiple source
370/// > lines (logical or physical). When macro is defined `__LINE__` is
371/// > substituted with the line number of the first character of the macro
372/// > name of the (multi-line) macro invocation. When this macro is not
373/// > defined `__LINE__` is replaced (as traditional on older C++ compilers)
374/// > by the line number of the last character of the macro invocation that
375/// > expands to a use of `__LINE__`. See also {Example 2: `__LINE__` Macro
376/// > Multi-line Value Differences Demonstration}.
377///
378/// * `BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES`
379/// > This macro is defined if alias templates are supported by the current
380/// > compiler settings for this platform.
381///
382/// * `BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS`
383/// > This macro is defined if `alignas` alignment specifier is supported by
384/// > the current compiler settings for this platform.
385///
386/// * `BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH`
387/// > This macro is defined if the `[[fallthrough]]` attribute is supported
388/// > by the current compiler settings for this platform.
389///
390/// * `BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED`
391/// > This macro is defined if the `[[maybe_unused]]` attribute is supported
392/// > by the current compiler settings for this platform.
393///
394/// * `BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD`
395/// > This macro is defined if the `[[nodiscard]]` attribute is supported by
396/// > the current compiler settings for this platform.
397///
398/// * `BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN`
399/// > This macro is defined if the `[[noreturn]]` attribute is supported by
400/// > the current compiler settings for this platform.
401///
402/// * `BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS`
403/// > This macro is defined if the concepts core language feature is
404/// > supported by the current compiler settings for this platform, as
405/// > defined by ISO C++20.
406///
407/// * `BSLS_COMPILERFEATURES_SUPPORT_CONSTEVAL_CPP20`
408/// > This macro is defined if `consteval`, as defined by ISO C++20, is
409/// > supported by the current compiler settings for this platform.
410///
411/// * `BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR`
412/// > This macro is defined if `constexpr` is supported by the current
413/// > compiler settings for this platform.
414///
415/// * `BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14`
416/// > This macro is defined if `constexpr` with C++14 semantics is supported
417/// > by the current compiler settings for this platform. In particular,
418/// > this allows multiple statements in a `constexpr` function; changing
419/// > state of local variables within the function; and making non-`const`
420/// > member functions `constexpr`.
421///
422/// * `BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17`
423/// > This macro is defined if `constexpr` with C++17 semantics is supported
424/// > by the current compiler settings for this platform. In particular,
425/// > this allows lambda functions to be defined in a `constexpr` function.
426///
427/// * `BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP20`
428/// > This macro is defined if 'constexpr' with C++20 semantics is supported
429/// > by the current compiler settings for this platform. In particular,
430/// > this allows transient allocations.
431///
432/// * `BSLS_COMPILERFEATURES_SUPPORT_COROUTINE`
433/// > This macro is defined if coroutines with C++20 (or later) semantics are
434/// > supported by the current compiler settings, including the existence of
435/// > the <coroutine> standard header that provides the basic library
436/// > facilities necessary to make use of coroutines.
437///
438/// * `BSLS_COMPILERFEATURES_SUPPORT_CTAD`
439/// > This macro is defined if template argument deduction introduced in the
440/// > C++17 Standard are supported by the current compiler settings for this
441/// > platform.
442///
443/// * `BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE`
444/// > This macro is defined if `decltype` is supported by the current
445/// > compiler settings for this platform.
446///
447/// * `BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS`
448/// > This macro is defined if default template arguments for function
449/// > templates are supported by the current compiler settings for this
450/// > platform.
451///
452/// * `BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS`
453/// > This macro is defined if defaulted functions are supported by the
454/// > current compiler settings for this platform (i.e., via the `= default`
455/// > syntax).
456///
457/// * `BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS`
458/// > This macro is defined if deleted functions are supported by the
459/// > current compiler settings for this platform (i.e., via the `= delete`
460/// > syntax).
461///
462/// * `BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS`
463/// > This macro is defined if `enum class` is supported by the current
464/// > compiler settings for this platform.
465///
466/// * `BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE`
467/// > This macro is defined if `extern template` is supported by the current
468/// > compiler settings for this platform.
469///
470/// * `BSLS_COMPILERFEATURES_SUPPORT_FINAL`
471/// > This macro is defined if `final` is supported for classes and member
472/// > functions by the current compiler settings for this platform.
473///
474/// * `BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS`
475/// > This macro is defined if generalized initializers are supported by the
476/// > current compiler settings for this platform.
477///
478/// * `BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE`
479/// > This macro is defined if `__has_include` is supported by the current
480/// > compiler settings for this platform.
481///
482/// * `BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS`
483/// > This macro is defined if hexadecimal format literals for floating point
484/// > types are supported by the current compiler settings for this platform.
485///
486/// * `BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT`
487/// > This macro is defined if @ref include_next is supported by the current
488/// > compiler settings for this platform.
489///
490/// * `BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE`
491/// > This macro is defined if `inline` namespaces introduced in the C++11
492/// > Standard are supported by the current compiler settings for this
493/// > platform.
494///
495/// * `BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES`
496/// > This macro is defined if `inline` variables introduced in the C++17
497/// > Standard are supported by the current compiler settings for this
498/// > platform.
499///
500/// * `BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT`
501/// > This macro is defined if the `noexcept` keyword is supported by the
502/// > current compiler settings for this platform, both for designating a
503/// > function as not throwing and for testing if an expression may throw.
504/// > The definition of this macro does not depend on whether the current
505/// > compiler configuration has disabled support for exceptions.
506///
507/// * `BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE`
508/// > This macro is defined if the `noexcept` keyword is supported by the
509/// > current compiler settings for this platform such that if `noexcept` is
510/// > used to designate a function as not throwing, that use of `noexcept` is
511/// > explicitly considered part of the type of the function (a feature
512/// > introduced in C++17). The definition of this macro does not depend on
513/// > whether the current compiler configuration has disabled support for
514/// > exceptions.
515///
516/// * `BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_TYPES`
517/// > Deprecated, use `BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE`
518/// > instead.
519///
520/// * `BSLS_COMPILERFEATURES_SUPPORT_NULLPTR`
521/// > This macro is defined if `nullptr` is supported by the current compiler
522/// > settings for this platform.
523///
524/// * `BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT`
525/// > This macro is defined if the `explicit` keyword applied to conversion
526/// > operators is supported by the current compiler settings for this
527/// > platform.
528///
529/// * `BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE`
530/// > This macro is defined if the `override` keyword is supported by the
531/// > current compiler settings for this platform.
532///
533/// * `BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS`
534/// > This macro is defined if the compiler supports C++-11-style
535/// > R"tag(string)tag" strings.
536///
537/// * `BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS`
538/// > This macro is defined if member functions with trailing reference
539/// > qualifiers (e.g., `void myfunc(int) &&`) are supported by the current
540/// > compiler settings for this platform.
541///
542/// * `BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES`
543/// > This macro is defined if rvalue references are supported by the current
544/// > compiler settings for this platform.
545///
546/// * `BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT`
547/// > This macro is defined if @ref static_assert is supported by the current
548/// > compiler settings for this platform.
549///
550/// * `BSLS_COMPILERFEATURES_SUPPORT_STATIC_CALL_OPERATOR`
551/// > This macro is defined if `static operator()` is supported by the current
552/// > compiler settings for this platform.
553///
554/// * `BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON`
555/// > This macro is defined if `<=>` operator is supported by the current
556/// > compiler settings for this platform. Including full library support as
557/// > of C++20.
558///
559/// * `BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS`
560/// > This macro is defined if dynamic exception specifications are supported
561/// > by the current compiler settings for this platform. Dynamic exception
562/// > specifications were deprecated in C++11, and actively removed from the
563/// > language in C++17. The definition of this macro does not depend on
564/// > whether the current compiler configuration has disabled support for
565/// > exceptions.
566///
567/// * `BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER`
568/// > This macro is defined if the standard library for the current compiler
569/// > settings for this platform supports some form of the standard
570/// > `<type_traits>` header. Note that many standard library
571/// > implementations provided partial support for a long time, and those
572/// > libraries *will* be identified as providing the `<type_traits>` header.
573///
574/// * `BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES`
575/// > This macro is defined if the compiler supports the `char16_t` and
576/// > `char32_t` types and the related u and U prefixes for character- and
577/// > string-literal values.
578///
579/// * `BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS`
580/// > This macro is defined if user-defined literals are supported by the
581/// > current compiler settings for this platform.
582///
583/// * `BSLS_COMPILERFEATURES_SUPPORT_UTF8_CHAR_TYPE`
584/// > This macro is defined if the compiler supports the `char8_t` type.
585///
586/// * `BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES`
587/// > This macro is defined if variadic template parameters are supported by
588/// > the current compiler settings for this platform.
589///
590/// * `BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES`
591/// > This macro is defined if variable templates introduced in the C++14
592/// > Standard are supported by the current compiler settings for this
593/// > platform.
594///
595/// ## Usage {#bsls_compilerfeatures-usage}
596///
597///
598/// The following code snippets illustrate use of this component.
599///
600/// ### Example 1: Using BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE {#bsls_compilerfeatures-example-1-using-bsls_compilerfeatures_support_extern_template}
601///
602///
603/// Suppose that we wish to "preinstantiate" `bsl::basic_string` for a given
604/// character type, say, `char`, on platforms that support `extern template`.
605/// To accomplish this, we would do the following in the `.h` and `.cpp` files
606/// of the @ref bslstl_string component:
607/// @code
608/// // bslstl_string.h
609/// // ...
610/// #ifdef BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE
611/// extern template class bsl::String_Imp<char, bsl::string::size_type>;
612/// extern template class bsl::basic_string<char>;
613/// #endif
614/// // ...
615///
616/// // bslstl_string.cpp
617/// // ...
618/// #ifdef BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE
619/// template class bsl::String_Imp<char, bsl::string::size_type>;
620/// template class bsl::basic_string<char>;
621/// #endif
622/// // ...
623/// @endcode
624///
625/// ### Example 2: __LINE__ Macro Multi-line Value Differences Demonstration {#bsls_compilerfeatures-example-2-__line__-macro-multi-line-value-differences-demonstration}
626///
627///
628/// Note that this isn't an example of use, it is a demonstration of compiler
629/// preprocessor behavior and the `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST`
630/// macro.
631///
632/// Sometimes we write code that uses line numbers for logging or other
633/// purposes. Although most of the time the precise values of those line
634/// numbers (in program output, such as assertions, or logs) is unimportant
635/// (the output is read by humans who are good at finding the line that
636/// actually emitted the text), sometimes programs read other programs' output.
637/// In such cases the precise values for the line numbers may matter. This
638/// example demonstrates the two ways our currently supported C++ compilers
639/// generate line numbers in multi-line macro expansion contexts (from the
640/// `__LINE__` macro), and how the presence (or absence) of the macro
641/// `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST` indicates which method the
642/// current compiler uses. First, we define a macro that uses `__LINE__` in its
643/// replacement text:
644/// @code
645/// #define THATS_MY_LINE(dummy) __LINE__
646/// @endcode
647/// Note that this macro has the function-like syntax so we can easily span its
648/// invocation to multiple lines.
649///
650/// Next, we record the current line number in a constant, and also record the
651/// line number from our macro, but we span the macro invocation multiple lines
652/// to invoke the unspecified behavior.
653///
654/// The two lines must follow each other due to working with line numbering:
655/// @code
656/// const long A_LINE = __LINE__;
657/// const long LINE_FROM_MACRO = THATS_MY_LINE
658/// (
659/// "dummy"
660/// )
661/// . ;
662/// @endcode
663/// We deliberately extended the macro invocation to more than 2 physical source
664/// code lines so that we can demonstrate the two distinct behaviors: using the
665/// line number of the first character or the last. Extending the number of
666/// lines *beyond* the macro invocation (by placing the semicolon on its own
667/// line) has no effect on the line number substitution inside the macro. The
668/// dummy argument is required for C++03 compatibility.
669///
670/// If we follow the definition of `A_LINE` without any intervening empty lines
671/// the line number of the first character of the macro invocation will be
672/// `A_LINE + 1`, while the last falls on line `A_LINE + 4`.
673///
674/// Now we demonstrate the two different behaviors and how the presence of
675/// `BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST` indicates which one will occur:
676/// @code
677/// #ifdef BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST
678/// assert(A_LINE + 1 == LINE_FROM_MACRO);
679/// #else
680/// assert(A_LINE + 4 == LINE_FROM_MACRO);
681/// #endif
682/// @endcode
683/// Finally note that WG14 N2322 defines this behavior as *unspecified*,
684/// therefore it is in the realm of possibilities, although not likely (in C++
685/// compilers) that further, more complicated or even indeterminate behaviors
686/// may arise.
687///
688/// ## Bugs in Compilers {#bsls_compilerfeatures-bugs-in-compilers}
689///
690///
691///
692/// ### BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS {#bsls_compilerfeatures-bsls_compilerfeatures_initializer_list_leaks_on_exceptions}
693///
694///
695/// This macro is defined if the compiler leaks temporary objects constructed
696/// trying to initialize a `std::initializer_list` object in the event that one
697/// of the elements of the list throws from its constructor.
698///
699/// * Compilers affected:
700/// - GCC
701/// - Oracle CC 12.6
702///
703/// ## Feature Support in Compilers {#bsls_compilerfeatures-feature-support-in-compilers}
704///
705///
706///
707/// Note that https://en.cppreference.com/w/cpp/compiler_support is a useful
708/// reference for initial versions to test for support for various features.
709///
710/// ### BSLS_COMPILERFEATURES_FULL_CPP11 {#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp11}
711///
712///
713/// This macro is defined if the compiler supports all the syntax specified by
714/// the C++11 standard.
715///
716/// * Compiler support:
717/// - GCC 5.1
718/// - Clang 3.3
719/// - Visual Studio 2017 version 14.0 (<u>MSC</u>VER 1900)
720///
721/// ### BSLS_COMPILERFEATURES_FULL_CPP14 {#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp14}
722///
723///
724/// This macro is defined if the compiler supports all the syntax specified by
725/// the C++14 standard.
726///
727/// * Compiler support:
728/// - GCC 6.1
729/// - Clang 3.4*
730/// - Visual Studio 2017 version 15.3 (<u>MSC</u>VER 1911)
731///
732/// Note that Clang does not support sized deallocation operators (N3778) until
733/// release 19.1.
734///
735/// ### BSLS_COMPILERFEATURES_FULL_CPP17 {#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp17}
736///
737///
738/// This macro is defined if the compiler supports all the syntax specified by
739/// the C++17 standard.
740///
741/// * Compiler support:
742/// - GCC 9.1
743/// - Clang 7.0*
744/// - Visual Studio 2019 version 16.1 (<u>MSC</u>VER 1921)
745///
746/// Note that Clang does not support sized deallocation operators (N3778) until
747/// release 19.1.
748///
749/// ### BSLS_COMPILERFEATURES_FULL_CPP20 {#bsls_compilerfeatures-bsls_compilerfeatures_full_cpp20}
750///
751///
752/// This macro is defined if the compiler supports all the syntax specified by
753/// the C++20 standard.
754///
755/// * THIS MACRO IS NOT YET DEFINED FOR ANY PLATFORM *
756///
757/// ### BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST {#bsls_compilerfeatures-bsls_compilerfeatures_pp_line_is_on_first}
758///
759///
760/// This macro is defined if the compiler substitutes the `__LINE__` macro in
761/// macro expansions with the line number of the first character of the macro
762/// invocation, which is the recommended practice for the C preprocessor (see
763/// WG14 N2322 at http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2322.htm).
764/// Note that all BDE supported compilers that do not define this macro use the
765/// line number of the last character of the macro invocation instead.
766///
767/// * Compilers that implement N2322 Recommended practice:
768/// - GCC 9.0 and later
769///
770/// ### BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES {#bsls_compilerfeatures-bsls_compilerfeatures_support_alias_templates}
771///
772///
773/// This macro is defined if the compiler supports syntax to introduce a
774/// `typedef`-name using alias-declaration syntax, declaring a name for a family
775/// of types.
776///
777/// * Compiler support:
778/// - GCC 4.7
779/// - Clang 3.0
780/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
781/// - Oracle CC 12.4
782///
783/// ### BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS {#bsls_compilerfeatures-bsls_compilerfeatures_support_alignas}
784///
785///
786/// This macro is defined if the compiler supports the `alignas` alignment
787/// specifier.
788///
789/// * Compiler support:
790/// - GCC 4.8
791/// - Clang 3.0
792///
793/// This feature is not yet supported in Visual Studio, IBM xlC, Oracle CC.
794///
795/// ### BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN {#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_noreturn}
796///
797///
798/// This macro is defined if the compiler supports `[[noreturn]]` C++11
799/// attribute syntax. MSVC supports the attribute with alternative syntax
800/// __declspec(noreturn), earlier versions of GCC and Clang support the
801/// alternative syntax `__attribute__((noreturn))`, and xlC supports the
802/// alternative syntax `_Noreturn`. This macro does not support alternative
803/// syntaxes.
804///
805/// * Compiler support:
806/// - GCC 4.8
807/// - Clang 3.3
808/// - Visual Studio 2015 (<u>MSC</u>VER 1900)
809/// - Oracle CC 12.4
810///
811/// ### BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD {#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_nodiscard}
812///
813///
814/// This macro is defined if the compiler supports `[[nodiscard]]` C++17
815/// attribute syntax.
816///
817/// * Compiler support:
818/// - Visual Studio 2017 version 15.3 (<u>MSC</u>VER 1911)
819///
820/// ### BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH {#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_fallthrough}
821///
822///
823/// This macro is defined if the compiler supports `[[fallthrough]]` C++17
824/// attribute syntax.
825///
826/// * Compiler support:
827/// - GCC 7.3
828/// - Clang 3.3
829/// - Visual Studio 2017 version 15.0 (<u>MSC</u>VER 1910)
830///
831/// ### BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED {#bsls_compilerfeatures-bsls_compilerfeatures_support_attribute_maybe_unused}
832///
833///
834/// This macro is defined if the compiler supports `[[maybe_unused]]` C++17
835/// attribute syntax.
836///
837/// * Compiler support:
838/// - GCC 4.8
839/// - Clang 3.3
840/// - Visual Studio 2017 version 15.3 (<u>MSC</u>VER 1911)
841///
842/// ### BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS {#bsls_compilerfeatures-bsls_compilerfeatures_support_concepts}
843///
844///
845/// This macro is defined if the Concepts core language feature is fully
846/// supported, as defined by ISO C++20.
847///
848/// This macro is defined if the standard `__cpp_concepts` feature-test macro
849/// has at least `202002L` value.
850///
851/// * Compiler support:
852/// - GCC 12.1
853/// - Visual Studio 2022 version 17.2.2 (`_MSC_VER` 1932)
854/// - Clang 19.1
855///
856/// ### BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR {#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr}
857///
858///
859/// This macro is defined in the compiler supports the `constexpr` reserved
860/// keyword.
861///
862/// * Compiler support:
863/// - GCC 4.7
864/// - Clang 3.1
865/// - Visual Studio 2017 version 15.0 (<u>MSC</u>VER 1910)
866/// - IBM xlC 13
867/// - Oracle CC 12.4
868///
869/// ### BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14 {#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr_cpp14}
870///
871///
872/// This macro is defined in the compiler supports the `constexpr` reserved
873/// keyword with C++14 semantics.
874///
875/// * Compiler support:
876/// - gcc 6
877/// - clang 3.4
878/// - Visual Studio 2017 version 15.0 (<u>MSC</u>VER 1910)
879///
880/// ### BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17 {#bsls_compilerfeatures-bsls_compilerfeatures_support_constexpr_cpp17}
881///
882///
883/// This macro is defined if the compiler supports the `constexpr` reserved
884/// keyword with C++17 semantics.
885///
886/// * Compiler support:
887/// - gcc 7.3
888/// - clang 5
889/// - Visual Studio 2017 version 15.0 (<u>MSC</u>VER 1910)
890///
891/// ### BSLS_COMPILERFEATURES_SUPPORT_COROUTINE {#bsls_compilerfeatures-bsls_compilerfeatures_support_coroutine}
892///
893///
894/// This macro is defined if the compiler supports at least the C++20 coroutine
895/// core language features and also provides the `<coroutine>` standard header
896/// providing the basic library facilities necessary to make use of coroutines.
897///
898/// * Compiler support (in C++20 mode):
899/// - gcc 11.1
900/// - clang 14
901/// - Visual Studio 2019 version 16.11 (<u>MSC</u>VER 1929)
902///
903/// ### BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE {#bsls_compilerfeatures-bsls_compilerfeatures_support_decltype}
904///
905///
906/// This macro is defined if the compiler supports the `decltype` reserved word.
907///
908/// * Compiler support:
909/// - GCC 4.3
910/// - Clang 3.3
911/// - Visual Studio 2010 version 10.0 (<u>MSC</u>VER 1600)
912/// - IBM xlC 11.1
913/// - Oracle CC 12.4
914///
915/// ### BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS {#bsls_compilerfeatures-bsls_compilerfeatures_support_default_template_args}
916///
917///
918/// This macro is defined if the compiler supports syntax to introduce defaulted
919/// functions.
920///
921/// * Compiler support:
922/// - GCC 4.3
923/// - Clang 2.9
924/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
925/// - IBM xlC not supported?
926/// - Oracle CC 12.4
927///
928/// ### BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS {#bsls_compilerfeatures-bsls_compilerfeatures_support_defaulted_functions}
929///
930///
931/// This macro is defined if the compiler supports syntax to introduce defaulted
932/// functions.
933///
934/// * Compiler support:
935/// - GCC 4.4
936/// - Clang 2.9
937/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
938/// - IBM xlC 13.1
939/// - Oracle CC 12.4
940///
941/// ### BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS {#bsls_compilerfeatures-bsls_compilerfeatures_support_deleted_functions}
942///
943///
944/// This macro is defined if the compiler supports syntax to introduce deleted
945/// functions.
946///
947/// * Compiler support:
948/// - GCC 4.4
949/// - Clang 2.9
950/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
951/// - IBM xlC 13.1
952/// - Oracle CC 12.4
953///
954/// ### BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS {#bsls_compilerfeatures-bsls_compilerfeatures_support_enum_class}
955///
956///
957/// This macro is defined if the compiler supports strongly typed enumerations
958/// declared with `enum class`.
959///
960/// * Compiler support:
961/// - GCC 4.4
962/// - Clang (any)
963/// - Visual Studio 2012 version 11.0 (<u>MSC</u>VER 1700)
964///
965/// ### BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE {#bsls_compilerfeatures-bsls_compilerfeatures_support_extern_template}
966///
967///
968/// This macro is defined if the compiler supports allowing suppression of
969/// implicit instantiation of templates by prefixing an explicit instantiation
970/// directive with the `extern` keyword.
971///
972/// * Compiler support:
973/// - GCC 3.3
974/// - Clang (any)
975/// - Visual Studio 2010 version 10.0 (<u>MSC</u>VER 1600)
976/// - IBM xlC 11.1
977/// - Oracle CC 12.4
978///
979/// ### BSLS_COMPILERFEATURES_SUPPORT_FINAL {#bsls_compilerfeatures-bsls_compilerfeatures_support_final}
980///
981///
982/// This macro is defined if the compiler supports both finalizing a class using
983/// the `final` keyword after the class name as well as preventing further
984/// derived classes from overriding a `virtual` function by using `final` after
985/// its signature.
986///
987/// * Compiler support:
988/// - GCC 4.7
989/// - Clang 3.0
990/// - Visual Studio 2012 version 11.0 (<u>MSC</u>VER 1700)
991/// - IBM xlC 11.1
992/// - Oracle CC 12.4
993///
994/// ### BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS {#bsls_compilerfeatures-bsls_compilerfeatures_support_generalized_initializers}
995///
996///
997/// This macro is defined if the compiler supports generalized initializers.
998///
999/// * Compiler support:
1000/// - GCC 4.4
1001/// - Clang 3.1
1002/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
1003/// - IBM xlC not supported
1004/// - Oracle CC 13
1005///
1006/// ### BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE {#bsls_compilerfeatures-bsls_compilerfeatures_support_has_include}
1007///
1008///
1009/// This macro is defined if the compiler supports `__has_include` semantics as
1010/// defined in the C++17 Standard (see also P006R1). Note that this
1011/// preprocessor feature is often available in earlier language dialects.
1012///
1013/// * Compiler support:
1014/// - GCC 5.0
1015/// - clang (any)
1016/// - Visual Studio 2017 version 15.3 (<u>MSC</u>VER 1911)
1017///
1018/// ### BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT {#bsls_compilerfeatures-bsls_compilerfeatures_support_include_next}
1019///
1020///
1021/// This macro is defined if the compiler supports #include_next.
1022///
1023/// * Compiler support:
1024/// - GCC (any)
1025/// - Clang (any)
1026/// - IBM xlC 8
1027/// - Oracle CC 12.4
1028///
1029/// ### BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE {#bsls_compilerfeatures-bsls_compilerfeatures_support_inline_namespace}
1030///
1031///
1032/// This macro is defined if the compiler supports `inline` namespaces
1033/// introduced in the C++11 Standard.
1034///
1035/// * Compiler support:
1036/// - GCC 4.4
1037/// - Clang 2.9
1038/// - Visual Studio 2015 version 14.0 (<u>MSC</u>VER 1900)
1039/// - IBM xlC 11.1
1040/// - Oracle CC 12.4
1041///
1042/// ### BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES {#bsls_compilerfeatures-bsls_compilerfeatures_support_inline_variables}
1043///
1044///
1045/// This macro is defined if the compiler supports `inline` variables introduced
1046/// in the C++17 Standard.
1047///
1048/// * Compiler support:
1049/// - GCC 7.0
1050/// - Clang 3.9
1051/// - Visual Studio 2017 version 15.5 (<u>MSC</u>VER 1912)
1052///
1053/// ### BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT {#bsls_compilerfeatures-bsls_compilerfeatures_support_noexcept}
1054///
1055///
1056/// This macro is defined if the compiler supports the `noexcept` reserved
1057/// keyword.
1058///
1059/// * Compiler support:
1060/// - GCC 4.6
1061/// - Clang 3.0
1062/// - Visual Studio 2015 version 14.0 (<u>MSC</u>VER 1900)
1063///
1064/// ### BSLS_COMPILERFEATURES_SUPPORT_NULLPTR {#bsls_compilerfeatures-bsls_compilerfeatures_support_nullptr}
1065///
1066///
1067/// This macro is defined if the compiler supports the `nullptr` reserved word.
1068///
1069/// * Compiler support:
1070/// - GCC 4.6
1071/// - Clang 3.0
1072/// - Visual Studio 2010 version 10.0 (<u>MSC</u>VER 1600)
1073/// - IBM xlC 13.1
1074/// - Oracle CC 12.4
1075///
1076/// ### BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT {#bsls_compilerfeatures-bsls_compilerfeatures_support_operator_explicit}
1077///
1078///
1079/// This macro is defined if the compiler supports use of the `explicit` keyword
1080/// to indicate that a conversion operator only available for explicit
1081/// conversions.
1082///
1083/// * Compiler support:
1084/// - GCC 4.5
1085/// - Clang 3.0
1086/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
1087/// - IBM xlC 11.1
1088/// - Oracle CC 12.4
1089///
1090/// ### BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE {#bsls_compilerfeatures-bsls_compilerfeatures_support_override}
1091///
1092///
1093/// This macro is defined if the compiler supports use of the `override` keyword
1094/// to indicate that a member function is meant to override a `virtual` function
1095/// (and cause a failure if that is not the case).
1096///
1097/// * Compiler support:
1098/// - GCC 4.7
1099/// - Clang 3.0
1100/// - Visual Studio 2012 version 11.0 (<u>MSC</u>VER 1700)
1101/// - IBM xlC 11.1
1102/// - Oracle CC 12.4
1103///
1104/// ### BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS {#bsls_compilerfeatures-bsls_compilerfeatures_support_raw_strings}
1105///
1106///
1107/// This macro is defined if the compiler supports the use of C++11-style
1108/// R"tag(string)tag" strings.
1109///
1110/// * Compiler support:
1111/// - GCC 4.5
1112/// - Clang 3.3
1113/// - Visual Studio 2013 version 12.0 (<u>MSC</u>VER 1800)
1114/// - xlC 13.1.3 (Not yet supported by this component)
1115/// - Oracle CC 12.4
1116///
1117/// ### BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS {#bsls_compilerfeatures-bsls_compilerfeatures_support_ref_qualifiers}
1118///
1119///
1120/// This macro is defined if member functions with trailing reference qualifiers
1121/// (e.g., `void myfunc(int) &`) and rvalue reference qualifiers (e.g.,
1122/// `void myFunc(int) &&`) are supported. Note that this macro implies that
1123/// `BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES` is also defined.
1124///
1125/// * Compiler support:
1126/// - gcc 4.5 (rvalue references v2.1; original draft support in gcc 4.3 is
1127/// not correct with respect to final spec (v3.0))
1128/// - clang 2.9
1129/// - Visual Studio 2015 version 14.0 (<u>MSC</u>VER 1900)
1130/// - xlC 12.1
1131/// - Oracle CC 12.4
1132///
1133/// ### BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES {#bsls_compilerfeatures-bsls_compilerfeatures_support_rvalue_references}
1134///
1135///
1136/// This macro is defined if the compiler supports rvalue references and move
1137/// semantics compatible with the final C++11 specification. (Semantics have
1138/// changed since early draft proposals.)
1139///
1140/// * Compiler support:
1141/// - GCC 4.5 (rvalue references v2.1; original draft support in GCC 4.3 is
1142/// not correct with respect to final spec (v3.0))
1143/// - Clang 2.9
1144/// - Visual Studio 2010 version 10.0 (<u>MSC</u>VER 1600)
1145/// - IBM xlC 12.1
1146/// - Oracle CC 12.4
1147///
1148/// ### BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT {#bsls_compilerfeatures-bsls_compilerfeatures_support_static_assert}
1149///
1150///
1151/// This macro is defined if the compiler supports the @ref static_assert reserved
1152/// word.
1153///
1154/// * Compiler support:
1155/// - GCC 4.3
1156/// - Clang 2.9
1157/// - Visual Studio 2010 version 10.0 (<u>MSC</u>VER 1600)
1158/// - IBM xlC 11.1
1159/// - Oracle CC 12.4
1160///
1161///
1162/// ### BSLS_COMPILERFEATURES_SUPPORT_STATIC_CALL_OPERATOR {#bsls_compilerfeatures-bsls_compilerfeatures_support_static_call_operator}
1163///
1164///
1165/// This macro is defined if the compiler supports `static` declarations of
1166/// the function call operator, i.e., `static operator()(parameter-list)`.
1167/// This feture is typically enabled for C++23 and later.
1168///
1169/// * Compiler support:
1170/// - GCC 13.1
1171/// - Clang 16.0
1172/// - Visual Studio 2022 version 17.14 (<u>MSC</u>VER 1944)
1173///
1174/// ### BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON {#bsls_compilerfeatures-bsls_compilerfeatures_support_three_way_comparison}
1175///
1176///
1177/// This macro is defined if the compiler supports `<=>` operator.
1178///
1179/// * Compiler support:
1180/// - GCC 10.1
1181/// - Clang 11.0
1182/// - Visual Studio 2019 version 16.11 (<u>MSC</u>VER 1929)
1183///
1184/// ### BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES {#bsls_compilerfeatures-bsls_compilerfeatures_support_variadic_templates}
1185///
1186///
1187/// This macro is defined if the compiler supports the ability to express a
1188/// template that accepts an arbitrary number of parameters in a type-safe
1189/// manner.
1190///
1191/// * Compiler support:
1192/// - GCC 4.3
1193/// - Clang 2.9
1194/// - Visual Studio 2015 version 14.0 (<u>MSC</u>VER 1900)
1195/// - IBM xlC 11.1
1196/// - Oracle CC 12.4
1197///
1198/// ### BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES {#bsls_compilerfeatures-bsls_compilerfeatures_support_variable_templates}
1199///
1200///
1201/// This macro is defined if the compiler supports variable templates introduced
1202/// in the C++14 Standard.
1203///
1204/// * Compiler support:
1205/// - gcc 5.0
1206/// - clang 3.4
1207/// - Visual Studio 2015 version 14.0 (<u>MSC</u>VER 1900)
1208/// - Oracle CC 12.4
1209///
1210/// ## Microsoft Visual Studio versions mapping {#bsls_compilerfeatures-microsoft-visual-studio-versions-mapping}
1211///
1212///
1213/// Microsoft Visual C++ in Microsoft Visual Studio has *many* different
1214/// associated versions:
1215///
1216/// * Microsoft Visual Studio release name (such as 2015, 2019, 2022 etc.)
1217/// * Microsoft Visual Studio update number (such as Update 6)
1218/// * Microsoft Visual Studio version number (such as 15.6.1)
1219/// * Microsoft Visual C++ Toolset version number (such as 14.30)
1220/// * C++ compiler version number and `_MSVC_VER` (such as 19.32 and 1932)
1221/// * C++ compiler `_MSVC_FULL_VER` (such as 193231329)
1222///
1223/// The following table shows the mapping between the different version numbers.
1224/// The source for the table was
1225/// https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
1226/// and the `_MSC_VER` entry on
1227/// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros
1228/// at 2020-12-13 20:00-05:00 (EST/New York).
1229///
1230/// @code
1231/// +-------------------+----------+---------+----------+---------------+
1232/// | Visual Studio name & version | Toolset | _MSC_VER | _MSC_FULL_VER |
1233/// +===================+==========+=========+==========+===============+
1234/// | 2015 | 14.0 | 14.0 | 1900 | 190023026 |
1235/// | 2015 Update 1 | 14.0 | 14.0 | 1900 | 190023506 |
1236/// | 2015 Update 2 | 14.0 | 14.0 | 1900 | 190023918 |
1237/// | 2015 Update 3 | 14.0 | 14.0 | 1900 | 190024210 |
1238/// +-------------------+----------+---------+----------+---------------+
1239/// | 2017 | 15.0 | 14.10 | 1910 | 191025017 |
1240/// | 2017 Update 1 | 15.1 | 14.10 | 1910 | 191025017 |
1241/// | 2017 Update 2 | 15.2 | 14.10 | 1910 | 191025017 |
1242/// | 2017 Update 3 | 15.3.3 | 14.11 | 1911 | 191125507 |
1243/// | 2017 Update 4 | 15.4.4 | 14.11 | 1911 | 191125542 |
1244/// | Update 4(*) | 15.4.5 | 14.11 | 1911 | 191125547 |
1245/// | 2017 Update 5 | 15.5.2 | 14.12 | 1912 | 191225831 |
1246/// | Update 5(*) | 15.5.3 | 14.12 | 1912 | 191225834 |
1247/// | Update 5(*) | 15.5.4 | 14.12 | 1912 | 191225834 |
1248/// | Update 5(*) | 15.5.6 | 14.12 | 1912 | 191225835 |
1249/// | Update 5(*) | 15.5.7 | 14.12 | 1912 | 191225835 |
1250/// | 2017 Update 6 | 15.6.0 | 14.13 | 1913 | 191326128 |
1251/// | Update 6(*) | 15.6.1 | 14.13 | 1913 | 191326128 |
1252/// | Update 6(*) | 15.6.2 | 14.13 | 1913 | 191326128 |
1253/// | Update 6(*) | 15.6.3 | 14.13 | 1913 | 191326129 |
1254/// | Update 6(*) | 15.6.4 | 14.13 | 1913 | 191326129 |
1255/// | Update 6(*) | 15.6.6 | 14.13 | 1913 | 191326131 |
1256/// | Update 6(*) | 15.6.7 | 14.13 | 1913 | 191326132 |
1257/// | 2017 Update 7 | 15.7.1 | 14.14 | 1914 | 191426428 |
1258/// | Update 7(*) | 15.7.2 | 14.14 | 1914 | 191426429 |
1259/// | Update 7(*) | 15.7.3 | 14.14 | 1914 | 191426430 |
1260/// | Update 7(*) | 15.7.5 | 14.14 | 1914 | 191426433 |
1261/// | 2017 Update 8 | 15.8.0 | 14.15 | 1915 | ? |
1262/// | 2017 Update 9 | 15.9.0 | 14.16 | 1916 | ? |
1263/// | Update 9(*) | 15.9.1 | 14.16 | 1916 | 191627023 |
1264/// | Update 9(*) | 15.9.4 | 14.16 | 1916 | 191627025 |
1265/// | Update 9(*) | 15.9.5 | 14.16 | 1916 | 191627026 |
1266/// | Update 9(*) | 15.9.7 | 14.16 | 1916 | 191627027 |
1267/// | Update 9(*) | 15.9.11 | 14.16 | 1916 | 191627030 |
1268/// +-------------------+----------+---------+----------+---------------+
1269/// | 2019 | 16.0 | 14.20 | 1920 | 192027508 |
1270/// | 2019 Update 1 | 16.1.2 | 14.21 | 1921 | 192127702 |
1271/// | 2019 Update 2 | 16.2.3 | 14.21 | 1922 | 192227905 |
1272/// | 2019 Update 3 | 16.3.2 | 14.21 | 1923 | 192328105 |
1273/// | 2019 Update 4 | 16.4.0 | 14.24 | 1924 | 192428314 |
1274/// | 2019 Update 5 | 16.5.1 | 14.25 | 1925 | 192528611 |
1275/// | 2019 Update 6 | 16.6.2 | 14.26 | 1926 | 192628806 |
1276/// | 2019 Update 7 | 16.7 | 14.27 | 1927 | 192729112 |
1277/// | 2019 Update 8 | 16.8.1 | 14.28 | 1928 | 192829333 |
1278/// | Update 8(*) | 16.8.2 | 14.28 | 1928 | 192829334 |
1279/// | 2019 Update 9 | 16.9.2 | 14.28 | 1928 | 192829913 |
1280/// | 2019 Update 11 | 16.11.2 | 14.28 | 1929 | 192930133 |
1281/// +-------------------+----------+---------+----------+---------------+
1282/// | 2022 | 17.0.1 | 14.30 | 1930 | 193030705 |
1283/// | 2022(*) | 17.0.2 | 14.30 | 1930 | 193030706 |
1284/// | 2022(*) | 17.2.2 | 14.30 | 1932 | 193231329 |
1285/// | 2022(*) | 17.3.4 | 14.30 | 1933 | 193331630 |
1286/// +-------------------+----------+---------+----------+---------------+
1287/// @endcode
1288/// (*) Visual Studio may receive interim updates that do not contribute into
1289/// the Visual Studio "human friendly" version, but are visible in other
1290/// version numbers.
1291/// @}
1292/** @} */
1293/** @} */
1294
1295/** @addtogroup bsl
1296 * @{
1297 */
1298/** @addtogroup bsls
1299 * @{
1300 */
1301/** @addtogroup bsls_compilerfeatures
1302 * @{
1303 */
1304
1305// ----------------------------------------------------------------------------
1306//
1307// ####################################################################
1308// ########################################################################
1309// ## ##
1310// ## THIS HEADER FILE HAS SPECIAL FORMATTING RULES! ##
1311// ## ************************************************ ##
1312// ## ##
1313// ## Please follow the rules below when updating it. ##
1314// ## ##
1315// ########################################################################
1316// ####################################################################
1317//
1318///Special Formatting Rules and Allowances
1319///---------------------------------------
1320// This header is a large and complex mesh of fairly unrelated and deep
1321// preprocessor conditionals with defining and undefining of many feature
1322// macros. It is hard for a human to scan this file and understand how and
1323// where particular feature macros are set. To make matter more difficult in
1324// certain circumstances we also unset/undefine macros. For this reason this
1325// header file uses a few special formatting rules to allow faster scanning:
1326//
1327// 1. Only comments and the `1` (replacement text) of {Binary Macros} may be 79
1328// characters long (plus newline). Line continuation characters in long
1329// preprocessor conditionals etc. must be placed onto column 78. This is to
1330// allow a human to easily scan the file for places where feature macros are
1331// being defined.
1332// 2. Feature macro definitions that are commented out (to indicate that for a
1333// given compiler + standard library combination the support does not exist)
1334// must not have the replacement text (the number 1) be present so as not to
1335// confuse a human reader not using syntax highlighting.
1336// 3. Due to the depth of necessary conditional branches (`#if*`) and the
1337// unusually long feature macro names defined in this header we use 2 spaces
1338// indentation to ensure that most preprocessor directives don't wrap (and
1339// become hard to read).
1340//
1341// ----------------------------------------------------------------------------
1342
1343#include <bsls_platform.h>
1344#include <bsls_macrorepeat.h>
1345
1346#ifdef __has_include
1347 #if __has_include(<version>)
1348 #include <version>
1349 #endif
1350#endif
1351
1352// ============================================================================
1353// VERIFY COMPILER VERSION SUPPORT FOR REQUESTED ISO LANGUAGE
1354// ============================================================================
1355
1356#ifndef BDE_BUILD_SKIP_VERSION_CHECKS
1357
1358 // Some level of C++20 is enabled, let's verify the compiler is supported
1359 #if __cplusplus > 201703L || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L)
1360 #if defined(BSLS_PLATFORM_CMP_GNU) && BSLS_PLATFORM_CMP_VERSION < 110100
1361 static_assert(0, "At least version 11.1 is required for C++20 support "
1362 "in GNU CC g++. This check can be disabled by defining the "
1363 "'BDE_BUILD_SKIP_VERSION_CHECKS' build flag.");
1364 #endif // Too old gcc for C++20
1365
1366 #if defined(BSLS_PLATFORM_CMP_CLANG) && BSLS_PLATFORM_CMP_VERSION < 150000
1367 static_assert(0, "At least version 15.0 is required for C++20 support "
1368 "in LLVM clang. This check can be disabled by defining the "
1369 "'BDE_BUILD_SKIP_VERSION_CHECKS' build flag.");
1370 #endif // Too old clang for C++20
1371
1372 #if defined(BSLS_PLATFORM_CMP_MSVC) && BSLS_PLATFORM_CMP_VERSION < 1930
1373 static_assert(0, "At least version 19.30 is required for C++20 support "
1374 "in MS Visual C++ (MS Visual Studio 2022). This check can be "
1375 "disabled by defining build flag 'BDE_BUILD_SKIP_VERSION_CHECKS'.");
1376 #endif // Too old MSVC for C++20
1377
1378 #if defined(BSLS_PLATFORM_CMP_IBM) || defined(BSLS_PLATFORM_CMP_SUN)
1379 #error "This compiler does not support C++20. This check can be " \
1380 "disabled by defining the 'BDE_BUILD_SKIP_VERSION_CHECKS' build "\
1381 "flag. See also " \
1382"http://bloomberg.github.io/bde/library_information/supported_platforms.html "\
1383 "for all compiler and other platform requirements."
1385 #endif // No C++20 on big iron
1386 #endif // C++20 features requested
1387#endif // ifndef BDE_BUILD_SKIP_VERSION_CHECKS
1388
1389// ============================================================================
1390// UNIVERSAL MACRO DEFINITIONS
1391// ============================================================================
1392
1393#if defined(__cplusplus)
1394 #define BSLS_COMPILERFEATURES_CPLUSPLUS __cplusplus
1395#else
1396 #define BSLS_COMPILERFEATURES_CPLUSPLUS 199711L
1397#endif
1398
1399// First, define feature macros for any C++98 features that should be available
1400// on all compilers, until removed by a later standard. These macros will be
1401// specifically undefined when compilers stop supporting that feature in a
1402// modern build mode.
1403#define BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS 1
1404
1405// Use the standard compiler-independent feature-test macros (SD-6) for
1406// compilers that support them. This support will be mandated by C++20, and it
1407// is expected that, at some point, future compilers will need only these
1408// universal definitions, and the platform-specific detection below will need
1409// no further maintenance.
1410#if defined(__cpp_guaranteed_copy_elision)
1411 #define BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION 1
1412#endif
1413
1414#if defined(__cpp_unicode_characters) && defined(__cpp_unicode_literals)
1415 #define BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES 1
1416#endif
1417
1418#if defined(__cpp_char8_t)
1419 #define BSLS_COMPILERFEATURES_SUPPORT_UTF8_CHAR_TYPE 1
1420#endif
1421
1422#if defined(__cpp_hex_float)
1423 #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS 1
1424#endif
1425
1426#if defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L
1427 // && defined(__cpp_lib_coroutine) && __cpp_lib_coroutine >= 201902L
1428 //
1429 // There are no known compilers that define the core language feature macro
1430 // but do not provide the corresponding library header. As *this* header
1431 // is included into almost every translation unit we won't
1432 // '#include <coroutine>' or the '<version>' standard headers (that would
1433 // '#define __cpp_lib_coroutine'), but we verify the presence and value of
1434 // '__cpp_lib_coroutine' both in the implementation file and the test
1435 // driver.
1436 #define BSLS_COMPILERFEATURES_SUPPORT_COROUTINE 1
1437#endif
1438
1439#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201611
1440 #define BSLS_COMPILERFEATURES_SUPPORT_CTAD 1
1441#endif
1442
1443#if defined(__cpp_concepts) && __cpp_concepts >= 202002L
1444 #define BSLS_COMPILERFEATURES_SUPPORT_CONCEPTS 1
1445#endif
1446
1447#if defined(__cpp_static_call_operator) && \
1448 __cpp_static_call_operator >= 202207L
1449 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_CALL_OPERATOR 1
1450#endif
1451
1452#if defined(__cpp_lib_hardware_interference_size) && \
1453 __cpp_lib_hardware_interference_size >= 201703L
1454 #define BSLS_COMPILERFEATURES_SUPPORT_HARDWARE_INTERFERENCE 1
1455#endif
1456
1457// Define BDE named macros for more capable evolutions of existing features
1458// that require testing multiple macros and values.
1459
1460#if __cplusplus > 201703L || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L)
1461 // We test against 201907L instead of the published 202002L.
1462 #if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L
1463 #if defined(__cpp_constexpr_dynamic_alloc) && \
1464 __cpp_constexpr_dynamic_alloc >= 201907L
1465 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP20 1
1466 #endif
1467 #endif
1468 #if defined(__cpp_consteval) && __cpp_consteval >= 201811L
1469 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEVAL_CPP20 1
1470 #endif
1471#endif
1472
1473// The following feature support macros have additional dependencies on library
1474// feature support in the `<version>` header.
1475
1476#if defined(__cpp_impl_three_way_comparison) && \
1477 __cpp_impl_three_way_comparison >= 201907L
1478 #if defined(__cpp_lib_three_way_comparison) && \
1479 __cpp_lib_three_way_comparison >= 201907L
1480 #define BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON 1
1481 #endif
1482#endif
1483
1484// ============================================================================
1485// ATTRIBUTE DETECTION
1486// ============================================================================
1487
1488#if (__cplusplus >= 201103L) && defined(__has_cpp_attribute)
1489
1490 #if __has_cpp_attribute(fallthrough)
1491 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH 1
1492 #endif
1493
1494 #if __has_cpp_attribute(noreturn)
1495 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN 1
1496 #endif
1497
1498 #if __has_cpp_attribute(nodiscard)
1499 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD 1
1500 #endif
1501
1502 #if __has_cpp_attribute(maybe_unused)
1503 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED 1
1504 #endif
1505
1506#endif
1507
1508// ============================================================================
1509// PLATFORM SPECIFIC FEATURE DETECTION AND MACRO DEFINITIONS
1510// ============================================================================
1511
1512// ============================================================================
1513// GNU Compiler Collection / gcc and g++
1514// ============================================================================
1515
1516//GCC
1517// https://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport
1518// As GCC tracked the evolving C++11 standard, earlier versions of the compiler
1519// have implementations of earlier specifications of features that can show up
1520// as bugs compared to the final standard. Therefore, BDE does not attempt to
1521// support C++11 in GCC compilers prior to the 4.8 release.
1522#if defined(BSLS_PLATFORM_CMP_GNU)
1523
1524 #define BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT 1
1525
1526 #if BSLS_PLATFORM_CMP_VERSION >= 30300
1527 #define BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE 1
1528 #endif // version >= 3.3
1529
1530 // GCC provides support to the following features, prior to C++17,
1531 // independent of language dialect.
1532 #if BSLS_PLATFORM_CMP_VERSION >= 50000
1533
1534 #ifndef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
1535 #define BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION 1
1536 #endif // feature test macro may have already defined this
1537
1538 #define BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE 1
1539 #endif // at least gcc 5.0
1540
1541 #if BSLS_PLATFORM_CMP_VERSION < 120000
1542 #define BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS 1
1543 #endif // before gcc 12.0
1544
1545 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || \
1546 (__cplusplus < 201500 && defined(__STRICT_ANSI__))
1547 // Supported gcc compilers *always* define '__cpp_hex_float', even if the
1548 // core language feature is not supported in the current configuration of
1549 // a build, and they define it to the exact same value ('201603LL')
1550 // regardless of actual support for literals. We remedy this by
1551 // undefining the hexfloat-literal-support macro in those cases when it
1552 // is not really supported, but gcc said so. There are 2 such cases:
1553 //: 1 Language mode is below C++11
1554 //: 2 Language mode is below C++17 experimental core language support and
1555 //: GNU extensions are not enabled.
1556 //
1557 // '__GXX_EXPERIMENTAL_CXX0X__' is defined when at least basic C++11
1558 // features are present (should be used instead of '__cplusplus').
1559 // g++ defines the '__cplusplus' macro to the non-standard value of
1560 // 201500 to indicate experimental C++17 support.
1561 #if defined(BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS)
1562 #undef BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
1563 #endif // '__cpp_hex_float' was defined, but is not supported.
1564 #endif // No C++11 or GNU extensions not enabled, C++17 not enabled
1565
1566 // GCC -std=c++11 or -std=c++0x or -std=gnu++11 or -std=gnu++0x
1567 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
1568
1569 #if BSLS_COMPILERFEATURES_CPLUSPLUS < 201103L
1570 #undef BSLS_COMPILERFEATURES_CPLUSPLUS
1571 #define BSLS_COMPILERFEATURES_CPLUSPLUS 201103L
1572 #endif // C++ standard date was set to older standard than C++11
1573
1574 #if BSLS_PLATFORM_CMP_VERSION >= 40800
1575 #define BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES 1
1576 #define BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS 1
1577 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN 1
1578 // GCC supports '__attribute__((noreturn))' in earlier versions
1579
1580 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR 1
1581 #define BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE 1
1582 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS 1
1583 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS 1
1584 #define BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS 1
1585 #define BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS 1
1586 #define BSLS_COMPILERFEATURES_SUPPORT_FINAL 1
1587 #define BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS 1
1588 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE 1
1589 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT 1
1590 #define BSLS_COMPILERFEATURES_SUPPORT_NULLPTR 1
1591 #define BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT 1
1592 #define BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE 1
1593 #define BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS 1
1594 #define BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS 1
1595 #define BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES 1
1596 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT 1
1597 #define BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS 1
1598 #define BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES 1
1599 #endif // at least gcc 4.8
1600
1601 #if BSLS_PLATFORM_CMP_VERSION >= 50000
1602 #define BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER 1
1603 // Note that while basic support is available in earlier versions
1604 // of the library, the full header is not implemented until gcc 5.0.
1605 #endif // at least gcc 5.0
1606 #endif // at least C++11
1607
1608 #if BSLS_PLATFORM_CMP_VERSION >= 90000
1609 #define BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST 1
1610 #endif // at least gcc 9.0
1611
1612 #if __cplusplus >= 201402L
1613 // Don't enable (not fully supported) extended constexpr rules for gcc 5.x.
1614 // See {DRQS 164511755} for details.
1615 #if BSLS_PLATFORM_CMP_VERSION >= 60000
1616 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14 1
1617 #endif // at least gcc 6.0
1618
1619 #define BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES 1
1620 #endif // at least C++14
1621
1622 // GCC defines the '__cplusplus' macro to the non-standard value of 201500 to
1623 // indicate experimental C++17 support.
1624 #if __cplusplus >= 201500
1625
1626 #if BSLS_PLATFORM_CMP_VERSION >= 70000
1627 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH 1
1628 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED 1
1629 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17 1
1630 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES 1
1631
1632 #ifndef BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
1633 #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS 1
1634 #endif // feature test macro may have already defined this
1635
1636 // C++98 throw specifications are removed in C++17 mode
1637 #undef BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS
1638 #endif // at least gcc 7.0
1639
1640 #if BSLS_PLATFORM_CMP_VERSION >= 70200
1641 // Early release of gcc 7.0 have a name-mangling bug with 'noexcept' on
1642 // "abominable" function types.
1643 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE 1
1644 #endif // at least gcc 7.2
1645 #endif // at least experimental C++17 support
1646
1647 // Define full CPP macros
1648 #if BSLS_PLATFORM_CMP_VERSION >= 50000
1649 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201103L
1650 #define BSLS_COMPILERFEATURES_FULL_CPP11 1
1651 #endif
1652 #endif
1653
1654 #if BSLS_PLATFORM_CMP_VERSION >= 60000
1655 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201402L
1656 #define BSLS_COMPILERFEATURES_FULL_CPP14 1
1657 #endif
1658 #endif
1659
1660 #if BSLS_PLATFORM_CMP_VERSION >= 90000
1661 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1662 #define BSLS_COMPILERFEATURES_FULL_CPP17 1
1663 #endif
1664 #endif
1665#endif // GNU Compiler Collection C++
1666
1667// ============================================================================
1668// LLVM Clang and Apple Clang / clang and clang++
1669// ============================================================================
1670
1671//Clang
1672// http://clang.llvm.org/cxx_status.html
1673// http://clang.llvm.org/docs/LanguageExtensions.html
1674#if defined(BSLS_PLATFORM_CMP_CLANG)
1675
1676 #ifndef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
1677 #define BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION 1
1678 #endif // feature test macro may have already defined this
1679
1680 #define BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE 1
1681
1682 #ifndef BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
1683 #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS 1
1684 #endif // feature test macro may have already defined this
1685
1686 #define BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT 1
1687 #define BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE 1
1688
1689 // clang -std=c++11 or -std=c++0x or -std=gnu++11 or -std=gnu++0x Clang 2.9
1690 #if __has_feature(cxx_rvalue_references)
1691 #define BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES 1
1692 #endif
1693
1694 #if __has_feature(cxx_reference_qualified_functions) && \
1695 __has_feature(cxx_rvalue_references)
1696 #define BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS 1
1697 #endif
1698
1699 #if __has_feature(cxx_default_function_template_args)
1700 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS 1
1701 #endif
1702
1703 #if __has_feature(cxx_defaulted_functions)
1704 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS 1
1705 #endif
1706
1707 #if __has_feature(cxx_deleted_functions)
1708 #define BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS 1
1709 #endif
1710
1711 #if __has_feature(cxx_static_assert)
1712 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT 1
1713 #endif
1714
1715 #if __has_feature(cxx_inline_namespaces) || \
1716 __has_extension(cxx_inline_namespaces)
1717 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE 1
1718 #endif
1719
1720 #if __has_feature(cxx_variadic_templates)
1721 #define BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES 1
1722 #endif
1723
1724 // Clang 3.0
1725 #if __has_feature(cxx_alias_templates)
1726 #define BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES 1
1727 #endif
1728
1729 #if __has_feature(cxx_noexcept)
1730 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT 1
1731 #endif
1732
1733 #if __has_feature(cxx_raw_string_literals)
1734 #define BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS 1
1735 #endif
1736
1737 // Clang 3.1
1738 #if __has_feature(cxx_constexpr)
1739 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR 1
1740 #endif
1741
1742 #if __has_feature(cxx_user_literals)
1743 #define BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS 1
1744 #endif
1745
1746 // Clang 3.4
1747 #if __has_feature(cxx_relaxed_constexpr)
1748 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14 1
1749 #endif
1750
1751 #if __has_feature(cxx_explicit_conversions)
1752 #define BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT 1
1753 #endif
1754
1755 #if __has_feature(cxx_override_control)
1756 #define BSLS_COMPILERFEATURES_SUPPORT_FINAL 1
1757 #define BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE 1
1758 #endif
1759
1760 #if __has_feature(cxx_nullptr)
1761 #define BSLS_COMPILERFEATURES_SUPPORT_NULLPTR 1
1762 #endif
1763
1764 // Clang 3.1
1765 #if __has_feature(cxx_generalized_initializers)
1766 #define BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS 1
1767 #endif
1768
1769 #if __has_feature(cxx_alignas)
1770 #define BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS 1
1771 #endif
1772
1773 // Clang 3.3
1774 #if __has_feature(cxx_decltype)
1775 #define BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE 1
1776 #endif
1777
1778 // Clang 3.4
1779 #if __has_feature(cxx_variable_templates)
1780 #define BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES 1
1781 #endif
1782
1783 #if __has_feature(cxx_attributes)
1784 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN 1
1785 // Note that Clang supports __attribute__((noreturn)) in earlier versions
1786 #endif
1787
1788 #if BSLS_COMPILERFEATURES_CPLUSPLUS < 201103L && \
1789 defined(__GXX_EXPERIMENTAL_CXX0X__)
1790 #undef BSLS_COMPILERFEATURES_CPLUSPLUS
1791 #define BSLS_COMPILERFEATURES_CPLUSPLUS 201103L
1792 #endif // too old standard date fixed up
1793
1794 #if (__cplusplus >= 201103L)
1795 #define BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS 1
1796 #endif
1797
1798 #if (__cplusplus >= 201103L || \
1799 (defined(__GXX_EXPERIMENTAL_CXX0X__) && \
1800 defined(__apple_build_version__))) \
1801 && __has_include(<type_traits>)
1802 #define BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER 1
1803 #endif // at least C++11 support and has the header
1804
1805 // works only with --std=c++1z or --std=c++17
1806 #if __cplusplus >= 201703L // at least C++17
1807 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17 1
1808 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES 1
1809 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE 1
1810 #endif // at least C++17
1811
1812 // When compiling in >= C++11 mode on a non-Darwin platform, assume that the
1813 // Clang version is at least 3.0 and accompanied by a GCC toolchain that is
1814 // at least version 4.8 and which supports clang.
1815 #if defined(__GXX_EXPERIMENTAL_CXX0X__) && \
1816 (!defined(__APPLE_CC__) || __APPLE_CC__ >= 6000)
1817 #define BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER 1
1818 #endif
1819
1820 // Define full CPP macros
1821 #if BSLS_PLATFORM_CMP_VERSION >= 30300
1822 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201103L
1823 #define BSLS_COMPILERFEATURES_FULL_CPP11 1
1824 #endif
1825 #endif
1826
1827 #if BSLS_PLATFORM_CMP_VERSION >= 30400
1828 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201402L
1829 #define BSLS_COMPILERFEATURES_FULL_CPP14 1
1830 #endif
1831 #endif
1832
1833 #if BSLS_PLATFORM_CMP_VERSION >= 70000
1834 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1835 #define BSLS_COMPILERFEATURES_FULL_CPP17 1
1836 #endif
1837 #endif
1838
1839 // clang does not yet follow WG14 N2322 Recommended practice
1840 // #define BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST
1841#endif // Clang
1842
1843// ============================================================================
1844// Microsoft Visual Studio / MSVC / cl.exe
1845// ============================================================================
1846
1847//MSVC (Minimum supported version is MSVC 2015)
1848// http://msdn.microsoft.com/en-us/library/hh567368.aspx
1849// http://blogs.msdn.com/b/vcblog/archive/2014/06/11/c-11-14-feature-tables-for-visual-studio-14-ctp1.aspx
1850#if defined(BSLS_PLATFORM_CMP_MSVC)
1851
1852// MSVC enables C++11 features automatically in versions that provide the
1853// feature. Features can not be disabled.
1854//
1855//: * extern template is not supported. It is documented as being "supported"
1856//: but behaves in a non-conforming manner.
1857
1858 #if BSLS_PLATFORM_CMP_VERSION < 1900
1859 #error Earliest supported toolset version is 19.0, Visual Studio 2015
1861 // Too old compiler, not supported.
1862 #endif // Earlier than Visual Studio 2015
1863
1864 // Not only does Microsoft not always report the language dialect properly in
1865 // '__cplusplus', many users depends upon it not reflecting the right
1866 // version, therefore we need to use the Microsoft specific predefined macro
1867 // '_MSVC_LANG'. See https://goo.gl/ikfyDw and
1868 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
1869 // Note that '_MSVC_LANG' is only useful for distinguishing MSVC 2017 from
1870 // MSVC 2014.
1871 #undef BSLS_COMPILERFEATURES_CPLUSPLUS
1872 #if defined(_MSVC_LANG)
1873 #define BSLS_COMPILERFEATURES_CPLUSPLUS _MSVC_LANG
1874 #else
1875 #define BSLS_COMPILERFEATURES_CPLUSPLUS 201103L
1876 #endif // _MSVC_LANG
1877
1878 #undef BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS
1879 // MSVC has never properly implemented this feature, even before it was
1880 // removed by C++17. It would parse the syntax, but the runtime behavior
1881 // simply would simply ignore the exception specification.
1882
1883 // These features are supported in the lowest version of MSVC we support
1884 #define BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES 1
1885 #define BSLS_COMPILERFEATURES_SUPPORT_ALIGNAS 1
1886 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN 1
1887 #define BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE 1
1888 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS 1
1889 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS 1
1890 #define BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS 1
1891 #define BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS 1
1892 #define BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE 1
1893 #define BSLS_COMPILERFEATURES_SUPPORT_FINAL 1
1894 #define BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS 1
1895 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE 1
1896 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT 1
1897 #define BSLS_COMPILERFEATURES_SUPPORT_NULLPTR 1
1898 #define BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT 1
1899 #define BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE 1
1900 #define BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS 1
1901 #define BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS 1
1902 #define BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES 1
1903 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT 1
1904 #define BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER 1
1905 #define BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS 1
1906 #define BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES 1
1907
1908 #ifndef BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION
1909 #define BSLS_COMPILERFEATURES_GUARANTEED_COPY_ELISION 1
1910 #endif // feature test macro may have already defined this
1911
1912 #ifndef BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES
1913 #define BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES 1
1914 #endif // feature test macro may have already defined this
1915
1916 // The variable template C++14 compiler feature is supported since Microsoft
1917 // Visual Studio 2015 update 2 toolset '_MSC_FULL_VER' 190023918.
1918 #if _MSC_FULL_VER >= 190023918
1919 #define BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES 1
1920 #endif // at least Microsoft Visual Studio 2015 Update 2
1921
1922 #if BSLS_PLATFORM_CMP_VERSION >= 1910 // Microsoft Visual Studio 2017
1923 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR 1
1924 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14 1
1925
1926 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1927 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_FALLTHROUGH 1
1928 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17 1
1929 #endif // at least C++17
1930 #endif // at least Microsoft Visual Studio 2017
1931
1932 // MSVC does not support the non-standard '#include_next' directive
1933 //#define BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT
1934
1935 // MS Visual Studio 2017 Update 4, toolset version 14.11
1936 #if BSLS_PLATFORM_CMP_VERSION >= 1911
1937 #define BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE 1
1938
1939 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1940 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_MAYBE_UNUSED 1
1941 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NODISCARD 1
1942
1943 #if !defined(BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS)
1944 #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS 1
1945 #endif // feature test macro may have already defined this
1946 #endif // at least C++17
1947 #endif // at least Microsoft Visual Studio 2017, toolset version 14.11
1948
1949 // MS Visual Studio 2017 Update 5, toolset version 14.12
1950 #if BSLS_PLATFORM_CMP_VERSION >= 1912
1951 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1952 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES 1
1953 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE 1
1954 #endif // at least C++17
1955 #endif // at least Microsoft Visual Studio 2017, toolset version 14.12
1956
1957 #if BSLS_PLATFORM_CMP_VERSION >= 1910 && BSLS_PLATFORM_CMP_VERSION < 1920
1958 // MSVC2017 crashes when building bsl_deque.h with CTAD enabled.
1959 #ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1960 #undef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1961 #endif
1962 #endif // some Microsoft Visual Studio 2017, toolset < 14.20
1963
1964 // Microsoft Visual Studio 2017
1965 #if BSLS_PLATFORM_CMP_VERSION >= 1910 // Microsoft Visual Studio 2017
1966 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201103L
1967 #define BSLS_COMPILERFEATURES_FULL_CPP11 1
1968 #endif
1969 #endif // at least Microsoft Visual Studio 2019, toolset version 14.21
1970
1971 // MS Visual Studio 2017 Update 4, toolset version 14.11
1972 #if BSLS_PLATFORM_CMP_VERSION >= 1911
1973 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201402L
1974 #define BSLS_COMPILERFEATURES_FULL_CPP14 1
1975 #endif
1976 #endif // at least Microsoft Visual Studio 2019, toolset version 14.21
1977
1978 // MS Visual Studio 2019 Update 1, toolset version 14.21
1979 #if BSLS_PLATFORM_CMP_VERSION >= 1921
1980 #if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
1981 #define BSLS_COMPILERFEATURES_FULL_CPP17 1
1982 #endif
1983 #endif // at least Microsoft Visual Studio 2019, toolset version 14.21
1984
1985 // Microsoft Visual Studio doesn't follow WG14 N2322 Recommended practice yet
1986 // #define BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST
1987#endif // Microsoft Visual Studio
1988
1989// ============================================================================
1990// IBM Visual Age / xlC
1991// ============================================================================
1992
1993#if defined(BSLS_PLATFORM_CMP_IBM)
1994// IBM Visual Age xlC 11.1 and better include increasing support for C++11
1995// http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/macros_lang_levels.html
1996// http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/opt_langlvl.html
1997// xlC_r -qlanglvl=extended (include next, extern template, noreturn)
1998// xlC_r -qlanglvl=extended0x (additional features)
1999
2000 #if defined(__IBMCPP_CONSTEXPR)
2001 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR 1
2002 #endif
2003
2004 #if defined(__IBMCPP_DECLTYPE)
2005 #define BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE 1
2006 #endif
2007
2008 #if defined(__IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS)
2009 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS 1
2010 #define BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS 1
2011 #endif
2012
2013 #if defined(__IBMCPP_EXPLICIT)
2014 #define BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT 1
2015 #endif
2016
2017 #if defined(__IBMCPP_EXTERN_TEMPLATE)
2018 #define BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE 1
2019 #endif
2020
2021 #if defined(__IBM_INCLUDE_NEXT)
2022 #define BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT 1
2023 #endif
2024
2025 #if defined(__IBMCPP_INLINE_NAMESPACE)
2026 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE 1
2027 #endif
2028
2029 #if defined(__IBMCPP_NULLPTR)
2030 #define BSLS_COMPILERFEATURES_SUPPORT_NULLPTR 1
2031 #endif
2032
2033 #if defined(__IBMCPP_OVERRIDE)
2034 #define BSLS_COMPILERFEATURES_SUPPORT_FINAL 1
2035 #define BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE 1
2036 #endif
2037
2038 #if defined(__IBMCPP_RVALUE_REFERENCES)
2039 #define BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS 1
2040 #define BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES 1
2041 #endif
2042
2043 #if defined(__IBMCPP_STATIC_ASSERT)
2044 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT 1
2045 #endif
2046
2047 #if defined(__IBMCPP_VARIADIC_TEMPLATES)
2048 #define BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES 1
2049 #endif
2050
2051 #if defined(__IBMC_NORETURN)
2052 // xlC has '_Noreturn', not the standard attribute
2053 //#define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN
2054 #endif
2055
2056 #if defined(__C99_HEX_FLOAT_CONST)
2057 // Unfortunately xlC does not compile hexadecimal floating point literals
2058 // properly (at least for the 'double' type that we use most). Denormal
2059 // values smaller than '0x0.8000000000000p-1022' are compiled to zero.
2060 // Hence we undefine this macro unless the compiler is updated (from
2061 // version 0x1001 where the bug was observed).
2062 #if BSLS_PLATFORM_CMP_VERSION <= 0x1001
2063 #ifdef BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
2064 #undef BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
2065 #endif
2066 #elif !defined(BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS)
2067 // The test driver verifies if the offending hexfloat literals now
2068 // compile to their proper values on this newer compiler version. If
2069 // not update the version check above to include this version as well.
2070 #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS 1
2071 #endif // standard feature test macro may have already defined this
2072 #endif
2073
2074 // (not yet supported in xlC)
2075 //https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/language_ref/cpp11_support.html
2076 //
2077 // #define BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES
2078 // #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14
2079 // #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17
2080 // #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT
2081 // #define BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS
2082
2083 // Not yet tested for support
2084 //
2085 // #define? BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS
2086 // #define? BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES
2087
2088 // Not yet enabling C++17 support, but pro-active test drivers may want to
2089 // add coverage.
2090 //
2091 // #define BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE
2092 // #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_VARIABLES
2093 // #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE
2094
2095 // IBM Visual Age Suite does not yet follow WG14 N2322 Recommended practice
2096 // #define BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST
2097#endif // IBM Visual Age Suite
2098
2099// ============================================================================
2100// Oracle Developer Studio / CC
2101// ============================================================================
2102
2103#if defined(BSLS_PLATFORM_CMP_SUN)
2104// Oracle Developer Studio 12.4 claims C++11 support except for C++11
2105// concurrency and atomic operations, and for user-defined literals
2106// http://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html#scrolltoc
2107// No C++11 features are available by default. To use any C++11 features, you
2108// must use the -std=c++11 option with the CC compiler.
2109// ('__cplusplus >= 201103L' when Oracle Solaris Studio 'CC -std=c++11' is
2110// invoked)
2111
2112 // CC -std=c++11 or later
2113 #if __cplusplus >= 201103L
2114
2115 // Oracle Developer Studio 12.4 (CC version 5.13) or newer
2116 #if BSLS_PLATFORM_CMP_VERSION >= 0x5130
2117 #define BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES 1
2118 #define BSLS_COMPILERFEATURES_SUPPORT_ATTRIBUTE_NORETURN 1
2119 #define BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE 1
2120 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULTED_FUNCTIONS 1
2121 #define BSLS_COMPILERFEATURES_SUPPORT_DELETED_FUNCTIONS 1
2122 #define BSLS_COMPILERFEATURES_SUPPORT_ENUM_CLASS 1
2123 #define BSLS_COMPILERFEATURES_SUPPORT_EXTERN_TEMPLATE 1
2124 #define BSLS_COMPILERFEATURES_SUPPORT_FINAL 1
2125 #define BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE 1
2126 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT 1
2127 #define BSLS_COMPILERFEATURES_SUPPORT_NULLPTR 1
2128 #define BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT 1
2129 #define BSLS_COMPILERFEATURES_SUPPORT_OVERRIDE 1
2130 #define BSLS_COMPILERFEATURES_SUPPORT_RAW_STRINGS 1
2131 #define BSLS_COMPILERFEATURES_SUPPORT_STATIC_ASSERT 1
2132 #endif // at least version 5.13
2133
2134 // Oracle Developer Studio 12.5 (CC version 5.14) or newer
2135 #if BSLS_PLATFORM_CMP_VERSION >= 0x5140
2136 #define BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS 1
2137 // CC 12.4 will overly aggressively match an initializer list when it
2138 // sees brace initialization, leading to rejection of valid code when
2139 // there is no valid initializer list conversion, but another method
2140 // creating a temporary object from the braced arguments should have
2141 // been chosen.
2142
2143 #define BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS 1
2144 // Although this feature might be available in an earlier compiler, we
2145 // are asking for trouble if we don't keep this feature together with
2146 // rvalue references.
2147
2148 #define BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES 1
2149 // CC 12.4 hits an awkward bug when performing deduction in some corner
2150 // cases, which happen to be important to our vector implementation.
2151
2152 #define BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER 1
2153 // The previous compiler ships with a mostly-complete version of the
2154 // <type_traits> header, but we insist on a full implementation before
2155 // defining this macro.
2156
2157 #define BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES 1
2158 // CC 12.4 has problems partially ordering template parameter packs
2159 // that typically result in failing to compile with ambiguity errors.
2160
2161 #define BSLS_COMPILERFEATURES_SUPPORT_UNICODE_CHAR_TYPES 1
2162
2163 #define BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS 1
2164 // https://docs.oracle.com/cd/E60778_01/html/E60742/gkeza.html
2165 #endif // at least version 5.14
2166
2167 // Newer than Oracle Developer Studio 12.6 (CC version 5.15)
2168 #if BSLS_PLATFORM_CMP_VERSION >= 0x5150
2169 #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR 1
2170 // CC 12.4 'constexpr' implementation almost satisfies our testing, but
2171 // the compiler crashes when for some rare-but-reasonable data
2172 // structures. CC 12.5 has different corner cases, although we are
2173 // still trying to track down a narrowed test case. Both 12.5 and
2174 // 12.6 have a regression compared to 12.4 though with the (implicit)
2175 // 'constexpr' constructors of aggregates that have dependent base
2176 // classes, such as most type traits.
2177
2178 #define BSLS_COMPILERFEATURES_SUPPORT_DEFAULT_TEMPLATE_ARGS 1
2179 // CC 12.4, CC 12.5, and 12.6 all fail in a very specific way, which,
2180 // unfortunately, breaks for 'shared_ptr' in a way that is widely used.
2181 // Note that the version check assumes the next revision of the
2182 // compiler will have this fix, or the test driver will force us to
2183 // update again.
2184 #endif // above version 5.15
2185
2186 // Not yet CC version 5.16 (Studio 12.7?)
2187 #if BSLS_PLATFORM_CMP_VERSION < 0x5160
2188 #define BSLS_COMPILERFEATURES_INITIALIZER_LIST_LEAKS_ON_EXCEPTIONS 1
2189 #endif // below version 5.16
2190 #endif // C++11 or later
2191
2192 // No C++14 features are available by default. To use any C++14 features,
2193 // you must use the -std=c++14 option with the CC compiler.
2194 // '__cplusplus >= 201402L' when Oracle Solaris Studio 'CC -std=c++14' is
2195 // invoked.
2196
2197 //CC -std=c++14
2198 #if __cplusplus >= 201402L
2199 // Newer than Oracle Developer Studio 12.6 (CC version 5.15)
2200 #if BSLS_PLATFORM_CMP_VERSION > 0x5150
2201 #define BSLS_COMPILERFEATURES_SUPPORT_VARIABLE_TEMPLATES 1
2202 #endif // above version 5.15
2203 #endif // C++14 or later
2204
2205 // No constexpr support
2206 // #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14
2207 // #define BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP17
2208
2209 // No '__include_next'
2210 // #define BSLS_COMPILERFEATURES_SUPPORT_INCLUDE_NEXT
2211
2212 // No C++17 features
2213 // #define BSLS_COMPILERFEATURES_SUPPORT_HAS_INCLUDE
2214 // #define BSLS_COMPILERFEATURES_SUPPORT_HEXFLOAT_LITERALS
2215 // #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE
2216
2217 // Oracle Solaris Studio does not yet follow WG14 N2322 Recommended practice
2218 // #define BSLS_COMPILERFEATURES_PP_LINE_IS_ON_FIRST
2219#endif // Oracle Developer Studio
2220
2221// ============================================================================
2222// DEPRECATED ALIASES
2223// ============================================================================
2224
2225#ifdef BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_IN_FNC_TYPE
2226 #define BSLS_COMPILERFEATURES_SUPPORT_NOEXCEPT_TYPES 1
2227#endif
2228
2229// ============================================================================
2230// STANDARD FEATURE-DETECTION MACROS
2231// ============================================================================
2232
2233#if defined(__cpp_lib_is_constant_evaluated)
2234 #define BSLS_COMPILERFEATURES_SUPPORT_IS_CONSTANT_EVALUATED 1
2235#endif
2236
2237// ============================================================================
2238// DISABLE FEATURES REMOVED BY LATER STANDARDS
2239// ============================================================================
2240
2241// Undefine macros defined for earlier dialects (including C++98) that are
2242// removed from later editions of the C++ Standard.
2243
2244#if BSLS_COMPILERFEATURES_CPLUSPLUS >= 201703L
2245 #undef BSLS_COMPILERFEATURES_SUPPORT_THROW_SPECIFICATIONS
2246#endif
2247
2248// ============================================================================
2249// ENFORCE LANGUAGE MODE
2250// ============================================================================
2251
2252#if defined(BSLS_COMPILERFEATURES_FULL_CPP11)
2253# if BSLS_COMPILERFEATURES_CPLUSPLUS < 201103L
2254# error C++11 is not enabled
2255# endif
2256#endif
2257#if defined(BSLS_COMPILERFEATURES_FULL_CPP14)
2258# if BSLS_COMPILERFEATURES_CPLUSPLUS < 201402L
2259# error C++14 is not enabled
2260# endif
2261#endif
2262#if defined(BSLS_COMPILERFEATURES_FULL_CPP17)
2263# if BSLS_COMPILERFEATURES_CPLUSPLUS < 201703L
2264# error C++17 is not enabled
2265# endif
2266#endif
2267#if defined(BSLS_COMPILERFEATURES_FULL_CPP20)
2268# if BSLS_COMPILERFEATURES_CPLUSPLUS < 202002L
2269# error C++20 is not enabled
2270# endif
2271#endif
2272#if defined(BSLS_COMPILERFEATURES_FULL_CPP23)
2273# if BSLS_COMPILERFEATURES_CPLUSPLUS < 202302L
2274# error C++23 is not enabled
2275# endif
2276#endif
2277
2278// ============================================================================
2279// ENFORCE FEATURE INTERACTIONS
2280// ============================================================================
2281
2282#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
2283 !defined(BSLS_COMPILERFEATURES_SUPPORT_ALIAS_TEMPLATES)
2284
2285 #undef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
2286 // BDE move-emulation for C++03 requires support for alias templates in
2287 // order to provide a transparent upgrade to the C++11 syntax that also
2288 // supports implicit-move from rvalues.
2289#endif
2290
2291// ============================================================================
2292// SIMULATE VARIOUS C++11 FEATURES
2293// ============================================================================
2294
2295#if !defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
2296
2297 #define BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES 1
2298
2299 #ifndef BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2300 #define BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES 1
2301 #endif
2302
2303 #if defined(__cplusplus) && BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2304
2305 #define BSLS_COMPILERFEATURES_NILT BloombergLP::bsls::CompilerFeaturesNilT
2306
2307 #define BSLS_COMPILERFEATURES_NILV BloombergLP::bsls::CompilerFeaturesNilV
2308
2309 #define BSLS_COMPILERFEATURES_NILTR(n) BSLS_COMPILERFEATURES_NILT,
2310
2311 #define BSLS_COMPILERFEATURES_FILLT(n) \
2312 BSLS_MACROREPEAT(n, BSLS_COMPILERFEATURES_NILTR) \
2313 BSLS_COMPILERFEATURES_NILT
2314
2315 #define BSLS_COMPILERFEATURES_NILVR(n) BSLS_COMPILERFEATURES_NILV,
2316
2317 #define BSLS_COMPILERFEATURES_FILLV(n) \
2318 BSLS_MACROREPEAT(n,BSLS_COMPILERFEATURES_NILVR) \
2319 BSLS_COMPILERFEATURES_NILV
2320
2321
2322namespace bsls {
2323
2324enum CompilerFeaturesNilT { COMPILERFEATURESNILV = 0x7fff6f76 };
2325
2326} // close package namespace
2327
2328
2329 #endif // C++ and BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES == 1
2330#endif // ! BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES
2331
2332#ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
2333 #define BSLS_COMPILERFEATURES_SIMULATE_FORWARD_WORKAROUND 1
2334
2335 #ifndef BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2336 #define BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES 1
2337 #endif
2338#endif
2339
2340#ifdef BSLS_COMPILERFEATURES_SIMULATE_FORWARD_WORKAROUND
2341 // Use a work-around for the absence of perfect-forwarding.
2342
2343 #define BSLS_COMPILERFEATURES_FORWARD_REF(T) const T&
2344 // On compilers that support C++11 perfect forwarding, replace with 'T&&',
2345 // i.e., an argument that can be perfect-forwarded; otherwise, replace with
2346 // 'const T&', the classic way to accept arguments of unknown
2347 // rvalue/lvalue-ness.
2348
2349 #define BSLS_COMPILERFEATURES_FORWARD(T,V) \
2350 ::BloombergLP::bslmf::Util::forward(V)
2351 // On compilers that support C++11 perfect forwarding, replace with
2352 // 'bsl::forward<T>(V)', i.e., use perfect-forwarding; otherwise, replace
2353 // with '(V)', the classic way to forward arguments safely.
2354
2355#else // !defined simulate forwarding
2356
2357 // Use real perfect-forwarding; no workaround needed. Note that the explicit
2358 // 'BloombergLP' qualification is needed for 'bsls::Util' when it is used
2359 // from within namespace 'bsl', the BDE standard library implementation.
2360
2361 #define BSLS_COMPILERFEATURES_FORWARD_REF(T) T&&
2362
2363 #define BSLS_COMPILERFEATURES_FORWARD(T,V) \
2364 ::BloombergLP::bsls::Util::forward<T>(V)
2365
2366#endif // forward-workaround for simulation
2367
2368#endif // header guard
2369
2370// ----------------------------------------------------------------------------
2371// Copyright 2025 Bloomberg Finance L.P.
2372//
2373// Licensed under the Apache License, Version 2.0 (the "License");
2374// you may not use this file except in compliance with the License.
2375// You may obtain a copy of the License at
2376//
2377// http://www.apache.org/licenses/LICENSE-2.0
2378//
2379// Unless required by applicable law or agreed to in writing, software
2380// distributed under the License is distributed on an "AS IS" BASIS,
2381// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2382// See the License for the specific language governing permissions and
2383// limitations under the License.
2384// ----------------------------- END-OF-FILE ----------------------------------
2385
2386/** @} */
2387/** @} */
2388/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_PLATFORM_COMPILER_ERROR
Definition bsls_platform.h:284
Definition bdlt_iso8601util.h:707