Changes between Version 6 and Version 7 of CppSupport


Ignore:
Timestamp:
Jul 17, 2019, 7:45:20 AM (5 years ago)
Author:
historic_bruno
Comment:

Updates for VS2015 in anticipation of #5379

Legend:

Unmodified
Added
Removed
Modified
  • CppSupport

    v6 v7  
    1010  * '''Note:''' older versions may work, but this isn't guaranteed
    1111 * Visual Studio 2013
     12  * '''Note:''' 2015 is recommended, see #5379.
     13  * Check this page's history for VS2013 features.
    1214
    1315The following tables summarize C++11 support for the above compilers. Features available (Y) in all supported compilers are marked green and believed safe to use. Features not available (N) in all supported compilers are marked red and generally should not be used in 0 A.D. In a few cases there is partial support (P), these rows are yellow.
     
    1719= C++11 Core Language Features =
    1820
    19 ||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =||
     21||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2015 =||= '''0 A.D. Support''' =||= Notes =||
    2022{{{#!tr style="background: LightGreen"
    2123||Emplacement||`emplace`, `emplace_back`||  Y  ||  Y  ||  Y  ||  Y  || ||
    2224}}}
     25{{{#!tr style="background: LightGreen"
     26||Rvalue references||`type_t &&`||  Y  ||  Y  ||  Y  ||  Y  || ||
     27}}}
     28{{{#!tr style="background: Pink"
     29||Rvalue references for *this||`void RValueFunc() &&;`||  Y  ||  Y  ||  N  ||  N  || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1821.htm N1821] ||
     30}}}
     31{{{#!tr style="background: LightGreen"
     32||Initialization of class objects by rvalues|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     33}}}
     34{{{#!tr style="background: LightGreen"
     35||Non-static data member initializers||`class Foo{ public: int bar=7; };`||  Y  ||  Y  ||  Y  ||  Y  || ||
     36}}}
     37{{{#!tr style="background: LightGreen"
     38||Variadic templates||`template<typename T, typename... Args>`||  Y  ||  Y  ||  Y  ||  Y  || ||
     39}}}
     40{{{#!tr style="background: LightGreen"
     41||Extending variadic template template parameters|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     42}}}
     43{{{#!tr style="background: LightGreen"
     44||Initializer lists||`vector<int> v = { 1, 2, 3, 4, 5, 6 };`||  Y  ||  Y  ||  Y  ||  Y  || ||
     45}}}
     46{{{#!tr style="background: LightGreen"
     47||Static assertions||`static_assert(expression,message);`||  Y  ||  Y  ||  Y  ||  Y  || ||
     48}}}
     49{{{#!tr style="background: LightGreen"
     50||auto-typed variables|| `for (auto p = v.begin(); p!=v.end(); ++p)` ||  Y  ||  Y  ||  Y  ||  Y  || ||
     51}}}
     52{{{#!tr style="background: LightGreen"
     53||Multi-declarator auto||`for (auto p = v.begin(), e=v.end(); p!=e; ++p)`||  Y  ||  Y  ||  Y  ||  Y  || ||
     54}}}
     55{{{#!tr style="background: LightGreen"
     56||Removal of auto as a storage-class specifier||~~`auto int r;`~~||  Y  ||  Y  ||  Y  ||  Y  || ||
     57}}}
     58{{{#!tr style="background: LightGreen"
     59||New function declarator syntax|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     60}}}
     61{{{#!tr style="background: LightGreen"
     62||New wording for C++0x lambdas|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     63}}}
     64{{{#!tr style="background: LightGreen"
     65||Declared type of an expression||`typedef decltype(a[0]*b[0]) Tmp;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     66}}}
     67{{{#!tr style="background: LightGreen"
     68||Incomplete return types|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     69}}}
     70{{{#!tr style="background: LightGreen"
     71||Right angle brackets||`list<vector<string>> lvs;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     72}}}
     73{{{#!tr style="background: LightGreen"
     74||Default template arguments for function templates|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     75}}}
    2376{{{#!tr style="background: LightYellow"
    24 ||Rvalue references||`type_t &&`||  Y  ||  Y  ||  P  ||  Y  || VS 2013 has [https://msdn.microsoft.com/en-us/library/hh567368.aspx#rvref partial] support ||
     77||Solving the SFINAE problem for expressions|| ||  Y  ||  Y  ||  P  ||  N  || ||
     78}}}
     79{{{#!tr style="background: LightGreen"
     80||Template aliases||`template<class T> using Vec = vector<T,My_alloc<T>>;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     81}}}
     82{{{#!tr style="background: LightGreen"
     83||Extern templates||`extern template class Foo<int>;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     84}}}
     85{{{#!tr style="background: LightGreen"
     86||Null pointer constant||`char* p = nullptr;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     87}}}
     88{{{#!tr style="background: LightGreen"
     89||Strongly-typed enums||`enum foo : int {};`||  Y  ||  Y  ||  Y  ||  Y  || ||
     90}}}
     91{{{#!tr style="background: LightGreen"
     92||Forward declarations for enums||`enum class Foo : char;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     93}}}
     94{{{#!tr style="background: LightGreen"
     95||Generalized attributes||`[[attributes]]`||  Y  ||  Y  ||  Y  ||  Y  || ||
     96}}}
     97{{{#!tr style="background: LightYellow"
     98||Generalized constant expressions||`constexpr int a = b.x;`||  Y  ||  Y  ||  P  ||  N  || Issues discovered in VS 2015 ||
     99}}}
     100{{{#!tr style="background: LightGreen"
     101||Alignment support||`alignas(16) char[100];`||  Y  ||  Y  ||  Y  ||  Y  ||  ||
     102}}}
     103{{{#!tr style="background: LightGreen"
     104||Delegating constructors|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     105}}}
     106{{{#!tr style="background: LightGreen"
     107||Inheriting constructors|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     108}}}
     109{{{#!tr style="background: LightGreen"
     110||Explicit conversion operators||`explicit operator bool()`||  Y  ||  Y  ||  Y  ||  Y  || ||
     111}}}
     112{{{#!tr style="background: LightGreen"
     113||New character types||`char16_t` / `char32_t`||  Y  ||  Y  ||  Y  ||  Y  || ||
     114}}}
     115{{{#!tr style="background: LightGreen"
     116||Unicode string literals||`u"string"`||  Y  ||  Y  ||  Y  ||  Y  || ||
     117}}}
     118{{{#!tr style="background: LightGreen"
     119||Raw string literals||` r"\string!\";`||  Y  ||  Y  ||  Y  ||  Y  || ||
     120}}}
     121{{{#!tr style="background: LightGreen"
     122||Universal character name literals|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     123}}}
     124{{{#!tr style="background: LightGreen"
     125||User-defined literals / extensible literals||`std::string operator""s (const char* p, size_t n)`||  Y  ||  Y  ||  Y  ||  Y  || ||
     126}}}
     127{{{#!tr style="background: LightGreen"
     128||Standard Layout Types||`struct Foo { int a; Foo(int aa) : a(aa) { } };`||  Y  ||  Y  ||  Y  ||  Y  || ||
     129}}}
     130{{{#!tr style="background: LightGreen"
     131||Defaulted and deleted functions||`X& operator=(const X&) = delete;`||  Y  ||  Y  ||  Y  ||  Y  || ||
     132}}}
     133{{{#!tr style="background: LightGreen"
     134||Extended friend declarations|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     135}}}
     136{{{#!tr style="background: LightGreen"
     137||Extending sizeof|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     138}}}
     139{{{#!tr style="background: LightGreen"
     140||Inline namespaces|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     141}}}
     142{{{#!tr style="background: LightGreen"
     143||Unrestricted unions|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     144}}}
     145{{{#!tr style="background: LightGreen"
     146||Local and unnamed types as template arguments|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     147}}}
     148{{{#!tr style="background: LightGreen"
     149||Range-based for||`for (auto x : vec)`||  Y  ||  Y  ||  Y  ||  Y  || ||
     150}}}
     151{{{#!tr style="background: LightGreen"
     152||Explicit virtual overrides||`void f() override;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    25153}}}
    26154{{{#!tr style="background: Pink"
    27 ||Rvalue references for *this||`void RValueFunc() &&;`||  Y  ||  Y  ||  N  ||  N  || ||
    28 }}}
    29 {{{#!tr style="background: LightGreen"
    30 ||Initialization of class objects by rvalues|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    31 }}}
    32 {{{#!tr style="background: LightGreen"
    33 ||Non-static data member initializers||`class Foo{ public: int bar=7; };`||  Y  ||  Y  ||  Y  ||  Y  || ||
    34 }}}
    35 {{{#!tr style="background: LightGreen"
    36 ||Variadic templates||`template<typename T, typename... Args>`||  Y  ||  Y  ||  Y  ||  Y  || ||
    37 }}}
    38 {{{#!tr style="background: LightGreen"
    39 ||Extending variadic template template parameters|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    40 }}}
    41 {{{#!tr style="background: LightGreen"
    42 ||Initializer lists||`vector<int> v = { 1, 2, 3, 4, 5, 6 };`||  Y  ||  Y  ||  Y  ||  Y  || ||
    43 }}}
    44 {{{#!tr style="background: LightGreen"
    45 ||Static assertions||`static_assert(expression,message);`||  Y  ||  Y  ||  Y  ||  Y  || ||
    46 }}}
    47 {{{#!tr style="background: LightGreen"
    48 ||auto-typed variables|| `for (auto p = v.begin(); p!=v.end(); ++p)` ||  Y  ||  Y  ||  Y  ||  Y  || ||
    49 }}}
    50 {{{#!tr style="background: LightGreen"
    51 ||Multi-declarator auto||`for (auto p = v.begin(), e=v.end(); p!=e; ++p)`||  Y  ||  Y  ||  Y  ||  Y  || ||
    52 }}}
    53 {{{#!tr style="background: LightGreen"
    54 ||Removal of auto as a storage-class specifier||~~`auto int r;`~~||  Y  ||  Y  ||  Y  ||  Y  || ||
    55 }}}
    56 {{{#!tr style="background: LightGreen"
    57 ||New function declarator syntax|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    58 }}}
    59 {{{#!tr style="background: LightGreen"
    60 ||New wording for C++0x lambdas|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    61 }}}
    62 {{{#!tr style="background: LightGreen"
    63 ||Declared type of an expression||`typedef decltype(a[0]*b[0]) Tmp;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    64 }}}
    65 {{{#!tr style="background: LightGreen"
    66 ||Incomplete return types|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    67 }}}
    68 {{{#!tr style="background: LightGreen"
    69 ||Right angle brackets||`list<vector<string>> lvs;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    70 }}}
    71 {{{#!tr style="background: LightGreen"
    72 ||Default template arguments for function templates|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    73 }}}
    74 {{{#!tr style="background: Pink"
    75 ||Solving the SFINAE problem for expressions|| ||  Y  ||  Y  ||  N  ||  N  || ||
    76 }}}
    77 {{{#!tr style="background: LightGreen"
    78 ||Template aliases||`template<class T> using Vec = vector<T,My_alloc<T>>;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    79 }}}
    80 {{{#!tr style="background: LightGreen"
    81 ||Extern templates||`extern template class Foo<int>;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    82 }}}
    83 {{{#!tr style="background: LightGreen"
    84 ||Null pointer constant||`char* p = nullptr;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    85 }}}
    86 {{{#!tr style="background: LightGreen"
    87 ||Strongly-typed enums||`enum foo : int {};`||  Y  ||  Y  ||  Y  ||  Y  || ||
    88 }}}
    89 {{{#!tr style="background: LightGreen"
    90 ||Forward declarations for enums||`enum class Foo : char;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    91 }}}
    92 {{{#!tr style="background: Pink"
    93 ||Generalized attributes||`[[attributes]]`||  Y  ||  Y  ||  N  ||  N  || ||
    94 }}}
    95 {{{#!tr style="background: Pink"
    96 ||Generalized constant expressions||`constexpr int a = b.x;`||  Y  ||  Y  ||  N  ||  N  || ||
     155||Minimal support for garbage collection and reachability-based leak detection|| ||  N  ||  N  ||  N  ||  N  || ||
     156}}}
     157{{{#!tr style="background: LightGreen"
     158||Allowing move constructors to throw [noexcept]|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     159}}}
     160{{{#!tr style="background: LightGreen"
     161||Defining move special member functions|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     162}}}
     163
     164== C++11 Core Language Features: Concurrency ==
     165
     166||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2015 =||= '''0 A.D. Support''' =||= Notes =||
     167{{{#!tr style="background: LightGreen"
     168||Revised sequence points|| ||  Y  ||  Y  ||  Y  ||  Y  || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html N2239] ||
     169}}}
     170{{{#!tr style="background: LightGreen"
     171||Atomic operations|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     172}}}
     173{{{#!tr style="background: LightGreen"
     174||Bidirectional Fences|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     175}}}
     176{{{#!tr style="background: LightGreen"
     177||Memory model|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     178}}}
     179{{{#!tr style="background: LightGreen"
     180||Data-dependency ordering: atomics and memory model|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     181}}}
     182{{{#!tr style="background: LightGreen"
     183||Propagating exceptions|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     184}}}
     185{{{#!tr style="background: LightGreen"
     186||Abandoning a process and at_quick_exit|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     187}}}
     188{{{#!tr style="background: LightGreen"
     189||Allow atomics use in signal handlers|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     190}}}
     191{{{#!tr style="background: LightGreen"
     192||Thread-local storage|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     193}}}
     194{{{#!tr style="background: LightGreen"
     195||Dynamic initialization and destruction with concurrency|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
     196}}}
     197
     198== C++11 Core Language Features: C99 ==
     199
     200||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2015 =||= '''0 A.D. Support''' =||= Notes =||
     201{{{#!tr style="background: LightGreen"
     202||!__func!__ predefined identifier|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    97203}}}
    98204{{{#!tr style="background: LightYellow"
    99 ||Alignment support||`alignas(16) char[100];`||  Y  ||  Y  ||  P  ||  P  ||  ||
    100 }}}
    101 {{{#!tr style="background: LightGreen"
    102 ||Delegating constructors|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    103 }}}
    104 {{{#!tr style="background: Pink"
    105 ||Inheriting constructors|| ||  Y  ||  Y  ||  N  ||  N  || ||
    106 }}}
    107 {{{#!tr style="background: LightGreen"
    108 ||Explicit conversion operators||`explicit operator bool()`||  Y  ||  Y  ||  Y  ||  Y  || ||
    109 }}}
    110 {{{#!tr style="background: Pink"
    111 ||New character types||`char16_t` / `char32_t`||  Y  ||  Y  ||  N  ||  N  || ||
    112 }}}
    113 {{{#!tr style="background: Pink"
    114 ||Unicode string literals||`u"string"`||  Y  ||  Y  ||  N  ||  N  || ||
    115 }}}
    116 {{{#!tr style="background: LightGreen"
    117 ||Raw string literals||` r"\string!\";`||  Y  ||  Y  ||  Y  ||  Y  || ||
    118 }}}
    119 {{{#!tr style="background: Pink"
    120 ||Universal character name literals|| ||  Y  ||  Y  ||  N  ||  N  || ||
    121 }}}
    122 {{{#!tr style="background: Pink"
    123 ||Extensible literals||`std::string operator""s (const char* p, size_t n)`||  Y  ||  Y  ||  N  ||  N  || ||
    124 }}}
    125 {{{#!tr style="background: LightGreen"
    126 ||Standard Layout Types||`struct Foo { int a; Foo(int aa) : a(aa) { } };`||  Y  ||  Y  ||  Y  ||  Y  || ||
    127 }}}
    128 {{{#!tr style="background: LightGreen"
    129 ||Defaulted and deleted functions||`X& operator=(const X&) = delete;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    130 }}}
    131 {{{#!tr style="background: LightGreen"
    132 ||Extended friend declarations|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    133 }}}
    134 {{{#!tr style="background: Pink"
    135 ||Extending sizeof|| ||  Y  ||  Y  ||  N  ||  N  || ||
    136 }}}
    137 {{{#!tr style="background: Pink"
    138 ||Inline namespaces|| ||  Y  ||  Y  ||  N  ||  N  || ||
    139 }}}
    140 {{{#!tr style="background: Pink"
    141 ||Unrestricted unions|| ||  Y  ||  Y  ||  N  ||  N  || ||
    142 }}}
    143 {{{#!tr style="background: LightGreen"
    144 ||Local and unnamed types as template arguments|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    145 }}}
    146 {{{#!tr style="background: LightGreen"
    147 ||Range-based for||`for (auto x : vec)`||  Y  ||  Y  ||  Y  ||  Y  || ||
    148 }}}
    149 {{{#!tr style="background: LightGreen"
    150 ||Explicit virtual overrides||`void f() override;`||  Y  ||  Y  ||  Y  ||  Y  || ||
    151 }}}
    152 {{{#!tr style="background: Pink"
    153 ||Minimal support for garbage collection and reachability-based leak detection|| ||  N  ||  N  ||  Y  ||  N  || ||
    154 }}}
    155 {{{#!tr style="background: Pink"
    156 ||Allowing move constructors to throw [noexcept]|| ||  Y  ||  Y  ||  N  ||  N  || ||
    157 }}}
    158 {{{#!tr style="background: Pink"
    159 ||Defining move special member functions|| ||  Y  ||  Y  ||  N  ||  N  || ||
    160 }}}
    161 
    162 == C++11 Core Language Features: Concurrency ==
    163 
    164 ||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =||
    165 {{{#!tr style="background: Pink"
    166 ||Sequence points|| ||  Y  ||  Y  ||  N  ||  N  || ||
    167 }}}
    168 {{{#!tr style="background: LightGreen"
    169 ||Atomic operations|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    170 }}}
    171 {{{#!tr style="background: LightGreen"
    172 ||Bidirectional Fences|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    173 }}}
    174 {{{#!tr style="background: Pink"
    175 ||Memory model|| ||  Y  ||  Y  ||  N  ||  N  || ||
    176 }}}
    177 {{{#!tr style="background: LightGreen"
    178 ||Data-dependency ordering: atomics and memory model|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    179 }}}
    180 {{{#!tr style="background: LightGreen"
    181 ||Propagating exceptions|| ||  Y  ||  Y  ||  Y  ||  Y  || ||
    182 }}}
    183 {{{#!tr style="background: Pink"
    184 ||Abandoning a process and at_quick_exit|| ||  Y  ||  Y  ||  N  ||  N  || ||
    185 }}}
    186 {{{#!tr style="background: Pink"
    187 ||Allow atomics use in signal handlers|| ||  Y  ||  Y  ||  N  ||  N  || ||
    188 }}}
    189 {{{#!tr style="background: LightYellow"
    190 ||Thread-local storage|| ||  Y  ||  Y  ||  P  ||  P  || ||
    191 }}}
    192 {{{#!tr style="background: Pink"
    193 ||Dynamic initialization and destruction with concurrency|| ||  Y  ||  Y  ||  N  ||  N  || ||
    194 }}}
    195 
    196 == C++11 Core Language Features: C99 ==
    197 
    198 ||= Feature =||= Example =||= GCC 4.8.1 =||= Clang 3.4 =||= VS 2013 =||= '''0 A.D. Support''' =||= Notes =||
    199 {{{#!tr style="background: Pink"
    200 ||!__func!__ predefined identifier|| ||  Y  ||  Y  ||  P  ||  N  || ||
    201 }}}
    202 {{{#!tr style="background: LightYellow"
    203 ||C99 preprocessor|| ||  Y  ||  Y  ||  P  ||  Y  || VS 2013 has partial support (Variadic macros are supported) ||
     205||C99 preprocessor|| ||  Y  ||  Y  ||  P  ||  P  || VS 2015 has partial support (Variadic macros are supported) ||
    204206}}}
    205207{{{#!tr style="background: LightGreen"
     
    2192211. Xcode Version Information: https://trac.macports.org/wiki/XcodeVersionInfo
    2202221. C++11 support in compilers: http://www.klayge.org/wiki/index.php/C%2B%2B11_support_in_compilers
     2231. Expression SFINAE improvements in VS 2015 Update 3: https://devblogs.microsoft.com/cppblog/expression-sfinae-improvements-in-vs-2015-update-3/