Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.


Artifact ID: 567fabaeb6f68dda2225d06d1f8010992912bacfae8262e0bd059beeededa8b9
Page Name:Per-Compiler Notes
Date: 2019-02-03 19:21:09
Original User: luismachuca
Parent: 6ef4b8c52753476931a465604b22bb26883df1b2d606f5f26e7fd1582a6eeb47

Per-Compiler Notes

Notes about setting up cxxomfort, and the support available, on different compilers and setups.

The notes take into consideration following the setup available in Installation for the testbed compilers.

GNU GCC -- MSVC -- CLang -- Digital Mars -- Open Watcom -- general notes


TR1 Implementation

For C++<11, GCC sets up TR1 components as files in the tr1/ include path and the features under the std::tr1 namespace. Cxxomfort sets up the macro CXXO_namespace_tr1 to the later value.

Unfortunately the TR1 headers are coded in such a way that it is not possible to add them to the #include search path. See [8ee003badda1c6033919702ac729de7c00ceb6b1] for the local report, GCC bugzilla for the associated bug and report about stl_list.h for more general information. The tl;dr of the problem is that adding TR1 to the #include path causes ambiguity errors in declarations that can not be solved without patching the non-TR1 headers themselves, such as stl_list.h.

Since GCC considers Tr1 "not worth fixing", which given its age makes sense, it is instead recommended to use a TR1 forwarder such as tr1_fwd, which is the supported and tested-for configuration in GCC C++03 mode; or any other TR1 forwarder set up by the user.

As of 2019-01-01 it is undecided if Cxxomfort will package its own TR1 forwarder.

Associated reports:

Short enum Types

GCC supports the -fshort-enums flag which allows enumeration types to use as a base types shorter than signed/unsigned int. Note that when this flag is enabled, the default implementation of typesafe enumeration types using library::typesafe_enum might change.

User code can check the result of sizeof(cxxomfort::fix::short_enum) to determine if short enums are enabled or not.


GCC >= 4.0 implements the __typeof__ extension in all Standard modes, which returns the type corresponding to an expression: it is basically an earlier alternative to decltype.

Cxxomfort declares the CXXO_TYPEOF(expression) macro to return __typeof__ of the expression in C++03 mode, or decltype of the expression in later Standards.

Microsoft Visual C++ Compiler

TR1 Implementation

MSVC 2008 ships without a TR1, and thus is unsupported.

MSVC 2008 SP1 ships with a TR1 implementation that is functional for Cxxomfort's requirements. The implementation uses the same header files as the normal C++ headers, as such MSVC does not require a TR1 forwarder or any other special treatment; also the features live in the std::tr1 namespace. Cxxofort defines the macro CXXO_namespace_tr1 to this later value so that features such as hash can be pointed to.

MSVC 2012 and later do not have a std::tr1 namespace.

MSVC 2010 std::common_type

MSVC 2010 and 2010 SP1 ship with a broken implementation of std::common_type that is not variadic, and can only take two types. Because this means that the name common_type is used, Cxxomfort can not extend this feature to more template arguments.

Code wanting to transparently use common_type can instead use cxxomfort::fix::common_type which will forward to the correct implementation (std or cxxomfort) depending on compiler version.

No typeof

MSVC < 2010 lacks any semblance to a __typeof__ mechanism. As such, code using CXXO_TYPEOF or CXXO_DECLTYPE will fail to compile. Note there is an extras:: feature that allows for an "auto" hack in MSVC 2008, but it is only a partial solution.


Most of the notes valid for GCC are also valid here.


Cxxomfort has not been tested with Clang using libc++, and has no support for it as of the last 2018 release.


Clang supports C++11 rvalue-references as an extension in C++03. Cxxomfort may or may not pick rvalue-reference constructors in C++03 when using Clang, but no guarantees are provided.

Digital Mars

Lacking C++ Support

The compiler supports a limited subset of C++, lacking features such as inline struct initialization, template constructors and template conversion operators (see "Template Support" below). Because of this, as of latest 2018 releases of Cxxomfort the library is not guaranteed to compile beyond the Base featureset.


Digital Mars provides minimal support for the decltype feature, although it lacks some of the corrections from later revisions such as decltype 1.1. Cxxomfort defines the macros CXXO_TYPEOF and CXXO_DECLTYPE to use this feature.

Template Support

Watcom 1.9 / OpenWatcom (beta)

Lacking C++ Support

The compiler supports a limited subset of C++, lacking features such as inline struct initialization, template constructors and template conversion operators (see "Template Support" below) and the proper base classes for the istream and ostream families. Because of this, as of latest 2018 releases of Cxxomfort the library is not guaranteed to compile beyond the Base featureset.

basic_istream, basic_ostream

Watcom 1.9 only supports the istream and ostream classes as sole classes, not templated on char type, and they inherit from ios rather than basic_ios; hence code that depends on prototypes for basic_istream or basic_ostream will fail to compile.

As of latest 2018 release Cxxomfort does not make any attempt to provide a basic_i/o_stream.

No TR1 Support

Watcom 1.9 / 2.0 beta has no support for C++ TR1 or its headers. As such <array>, <cstdint>, <tuple>, <type_traits> all required by Cxxomfort are missing.

A future version of Cxxomfort will include a set of supplemental headers to add to the compiler's search path.


Watcom defines NULL as integral zero, and also lacks template conversion operators; as such, nullptr can not be implemented as per C++11 official backport. For this compiler, Cxxomfort defines nullptr to be integral zero, and std::nullptr_t as an empty type with an implicit conversion to integral zero.

Template Support

General Notes

Compiler Lacks Basic C++ Support

Template Support


When using the macro CXXOMFORT_NOTICES to enable compilation logs, Cxxomfort makes use of #pragmas in order to emit the messages. It is implementation-defined by each compiler whether those notices are interpreted to be compilation messages or compilation warnings (which show in the build logs). As such, when setting CXXOMFORT_NOTICES on a project that uses such options as "treat warnings as errors", compilation should be expected to fail.


Using the library::type_name and typeid_demangle features require typeid support and thus RTTI to be enabled. (Though an assist using compile-time type index is under study)

Note 2019-02-01: Removing the RTTI requirement for type_name<T> on compilers that implement some sort of function-name reflection (such as __PRETTY_FUNCTION) is being considered.

Proceed with the Configuration