On 11/02/16 15:20 +0100, Marek Polacek wrote:
Does this look ok?
Looks OK, although how about stressing that it was only allowed as an extension previously, e.g. ...
Index: porting_to.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-6/porting_to.html,v retrieving revision 1.9 diff -u -r1.9 porting_to.html --- porting_to.html 10 Feb 2016 17:21:54 -0000 1.9 +++ porting_to.html 11 Feb 2016 14:18:59 -0000 @@ -269,6 +269,25 @@ to port the code to use C++11's <code>std::unique_ptr</code> instead. </p> +<h3>'constexpr' needed for in-class initialization of static data member</h3> +
In C++98 in-class initialization of static data members is only allowed for integral types, but as an extension G++ also allowed it for floating point types:
+ +<pre><code> +struct X { + const static double i = 10; +}; +</pre></code>
The C++11 standard supports that in-class initialization using <code>constexpr</code> instead, so the GNU extension is no longer supported for C++11 or later. Programs relying on the extension will be rejected with an error. The fix is to use <code>constexpr</code> instead of <code>const</code>.