[v3] Protect optional's deduction guide with the feature macro

Message ID CAFk2RUYAO-tRF-KXHSnAayZpxWU-qsrVEGHjx-DXzna56Xd5-Q@mail.gmail.com
State New
Headers show
Series
  • [v3] Protect optional's deduction guide with the feature macro
Related show

Commit Message

Ville Voutilainen Jan. 3, 2018, 2:34 p.m.
Tested partially on Linux-x64, finishing testing the full suite on
Linux-PPC64. Ok for trunk?

2018-01-03  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Protect optional's deduction guide with the feature macro
    * include/std/optional: Use the feature macro.

Comments

Jonathan Wakely Jan. 3, 2018, 7:57 p.m. | #1
On 03/01/18 16:34 +0200, Ville Voutilainen wrote:
>Tested partially on Linux-x64, finishing testing the full suite on

>Linux-PPC64. Ok for trunk?


Yes, and gcc-7-branch please. Thanks.

Patch

diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index e017eed..f7c72b5 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1038,7 +1038,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
+#if __cpp_deduction_guides >= 201606
   template <typename _Tp> optional(_Tp) -> optional<_Tp>;
+#endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std