{"id":6811,"date":"2015-06-02T12:43:53","date_gmt":"2015-06-02T12:43:53","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2015\/06\/02\/constexpr-complete-for-vs-2015-rtm-c11-compiler-c17-stl\/"},"modified":"2019-02-18T18:05:02","modified_gmt":"2019-02-18T18:05:02","slug":"constexpr-complete-for-vs-2015-rtm-c11-compiler-c17-stl","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/constexpr-complete-for-vs-2015-rtm-c11-compiler-c17-stl\/","title":{"rendered":"constexpr Complete For VS 2015 RTM: C++11 compiler, C++17 STL"},"content":{"rendered":"<p><span style=\"font-family:Verdana;font-size:12pt\">We&#8217;ve finished implementing constexpr for VS 2015 RTM, and we&#8217;ve updated the online compiler at <a href=\"http:\/\/webcompiler.cloudapp.net\/\"><span style=\"color:blue;text-decoration:underline\">webcompiler.cloudapp.net<\/span><\/a> with our latest development build.  <\/span>\n&nbsp;  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">As I <a href=\"http:\/\/blogs.msdn.com\/b\/vcblog\/archive\/2015\/04\/29\/c-11-14-17-features-in-vs-2015-rc.aspx\"><span style=\"color:blue;text-decoration:underline\">previously mentioned<\/span><\/a>, the compiler currently supports C++11&#8217;s original rules for constexpr.&nbsp; C++14 extended constexpr will be implemented in the future, but not in 2015 RTM.  <\/span>\n&nbsp;  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">In the STL, we&#8217;ve implemented every occurrence of constexpr in the current C++17 Working Paper <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2015\/n4527.pdf\"><span style=\"color:blue;text-decoration:underline\">N4527<\/span><\/a>, with a very small number of exceptions:  <\/span>\n  &nbsp;<\/p>\n<ul>\n<li><span style=\"font-family:Verdana;font-size:12pt\">min()\/max()\/minmax() for initializer_list (requires compiler support for C++14 extended constexpr)  <\/span><\/li>\n<li><span style=\"font-family:Verdana;font-size:12pt\">min_element()\/max_element()\/minmax_element() (same reason)  <\/span><\/li>\n<li><span style=\"font-family:Verdana;font-size:12pt\">numeric_limits&lt;float\/double\/long double&gt;::quiet_NaN()\/signaling_NaN() (requires compiler magic, as far as I can tell)  <\/span><\/li>\n<li><span style=\"font-family:Verdana;font-size:12pt\">mutex&#8217;s default constructor (needs to be significantly overhauled after we can drop support for XP targeting)  <\/span><\/li>\n<li><span style=\"font-family:Verdana;font-size:12pt\">error_category&#8217;s default constructor (in an earlier fix I used reinterpret_cast, which is incompatible with constexpr; I can easily change that, but not between RC and RTM)  <\/span><\/li>\n<\/ul>\n<p>  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">And by &#8220;implemented&#8221;, I mean that I&#8217;ve got a test case that exercises every occurrence of constexpr in the STL, which the compiler accepts without any workarounds.&nbsp; All the tricky stuff works, like bitset&#8217;s constructor from unsigned long long and tuple&#8217;s converting move constructor.  <\/span>\n&nbsp;  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">Of course, there are still some bugs lurking, especially given the magnitude of this feature.&nbsp; So, we&#8217;d like to invite you to try out the online compiler and report any issues you find.&nbsp; (And report them <strong>soon<\/strong>, like this week.)&nbsp; I&#8217;m not aware of any constexpr bugs in the STL, but there are a few compiler bugs that remain to be fixed &#8211; notably DevDiv#1134662 &#8220;constexpr constructors are emitting dynamic initializers&#8221; and 1165072 &#8220;constexpr ICE with brace elision&#8221; in our internal database.  <\/span>\n&nbsp;  &nbsp;\n<a href=\"https:\/\/connect.microsoft.com\/VisualStudio\"><span style=\"color:blue;font-family:Verdana;font-size:12pt;text-decoration:underline\">Microsoft Connect<\/span><\/a><span style=\"font-family:Verdana;font-size:12pt\"> is the official place to report bugs, but we&#8217;ll accept constexpr bug reports in VCBlog comments here.  <\/span>\n&nbsp;  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">Finally, credits: this was made possible by Tanveer Gani&#8217;s herculean work in the compiler, with \/analyze fixes contributed by Dave Bartolomeo.&nbsp; The STL was constexpr-ized by P.J. Plauger of Dinkumware and myself, with &lt;limits&gt; changes contributed by Alex Voicu.  <\/span>\n&nbsp;  &nbsp;\n<span style=\"font-family:Verdana;font-size:12pt\">Stephan T. Lavavej  <\/span>\n<span style=\"font-family:Verdana;font-size:12pt\">Senior Developer &#8211; Visual C++ Libraries  <\/span><\/p>\n<p><a href=\"http:\/\/blogs.msdn.commailto:stl@microsoft.com\"><span style=\"color:blue;font-family:Verdana;font-size:12pt;text-decoration:underline\">stl@microsoft.com<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve finished implementing constexpr for VS 2015 RTM, and we&#8217;ve updated the online compiler at webcompiler.cloudapp.net with our latest development build. &nbsp; &nbsp; As I previously mentioned, the compiler currently supports C++11&#8217;s original rules for constexpr.&nbsp; C++14 extended constexpr will be implemented in the future, but not in 2015 RTM. &nbsp; &nbsp; In the STL, [&hellip;]<\/p>\n","protected":false},"author":266,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6811","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>We&#8217;ve finished implementing constexpr for VS 2015 RTM, and we&#8217;ve updated the online compiler at webcompiler.cloudapp.net with our latest development build. &nbsp; &nbsp; As I previously mentioned, the compiler currently supports C++11&#8217;s original rules for constexpr.&nbsp; C++14 extended constexpr will be implemented in the future, but not in 2015 RTM. &nbsp; &nbsp; In the STL, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/6811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/266"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=6811"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/6811\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=6811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=6811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=6811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}