The versioned namespace build has been broken on all branches for some
time. It's due to new code that doesn't use the namespace macros in
the right places. This fixes all issues.

Rather than declaring the std::experimental::* namespaces in
<bits/c++config.h> I've added a new file that declares them and is
only included by LFTS headers. That allows the new test to pass, which
verifies that the std::experimental namespace doesn't exist when no TS
headers are included.

        PR libstdc++/68323
        PR libstdc++/77794
        * config/abi/pre/gnu-versioned-namespace.ver: Add exports for
        __cxa_thread_atexit and __gnu_cxx::__freeres.
        * include/Makefile.am: Add <experimental/bits/lfts_config.h>
        * include/Makefile.in: Regenerate.
        * include.bits/basic_string.h: Fix nesting of versioned namespaces.
        * include/bits/c++config: Declare versioned namespaces for literals.
        * include/bits/regex.h (basic_regex, match_results): Add workarounds
        for PR c++/59256.
        * include/bits/uniform_int_dist.h: Fix nesting of versioned namespace.
        * include/std/chrono: Likewise.
        * include/std/complex: Likewise.
        * include/std/string_view: Likewise.
        * include/std/variant: Likewise. Add workaround for PR c++/59256.
        * include/experimental/bits/fs_fwd.h: Declare versioned namespace.
        * include/experimental/bits/lfts_config.h: Declare versioned
        namespaces.
        * include/experimental/algorithm: Include
        <experimental/bits/lfts_config.h>.
        * include/experimental/any: Likewise.
        * include/experimental/bits/erase_if.h: Likewise.
        * include/experimental/chrono: Likewise.
        * include/experimental/functional: Likewise.
        * include/experimental/memory_resource: Likewise.
        * include/experimental/optional: Likewise.
        * include/experimental/propagate_const: Likewise.
        * include/experimental/random: Likewise.
        * include/experimental/ratio: Likewise.
        * include/experimental/system_error: Likewise.
        * include/experimental/tuple: Likewise.
        * include/experimental/type_traits: Likewise.
        * include/experimental/utility: Likewise.
        * include/experimental/string_view: Likewise. Fix nesting of
        versioned namespaces.
        * include/experimental/bits/string_view.tcc: Reopen inline namespace
        for non-inline function definitions.
        * testsuite/17_intro/using_namespace_std_exp_neg.cc: New test.
        * testsuite/20_util/duration/literals/range.cc: Adjust dg-error line.
        * testsuite/experimental/any/misc/any_cast_neg.cc: Likewise.
        * testsuite/experimental/propagate_const/assignment/move_neg.cc:
        Likewise.
        * testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements2.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements3.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements4.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements5.cc: Likewise.
        * testsuite/ext/profile/mutex_extensions_neg.cc: Likewise.

Tested x86_64-linux, with --enable-symvers=gnu-versioned-namespace and
--enable-symvers=gnu, on trunk and gcc-6 and gcc-5 branches.

The only failures are in synopsis.cc tests which expect to be able to
redeclare names in namespace std (which is ambiguous if they're really
declared in std::__7) or in tests that use scan-assembler or GDB and
the expected strings are different due to the __7 namespace. I will
probably add an effective target for the versioned namespace so we can
disable those tests when they're going to fail.

Committed to trunk and gcc-6 and gcc-5 branches.

commit 7a3e391a33130d8cee8d763978b6fdc7b0ffd8ea
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Oct 3 14:35:28 2016 +0000

    Fix libstdc++ versioned namespace build
    
        PR libstdc++/68323
        PR libstdc++/77794
        * config/abi/pre/gnu-versioned-namespace.ver: Add exports for
        __cxa_thread_atexit and __gnu_cxx::__freeres.
        * include/Makefile.am: Add <experimental/bits/lfts_config.h>
        * include/Makefile.in: Regenerate.
        * include.bits/basic_string.h: Fix nesting of versioned namespaces.
        * include/bits/c++config: Declare versioned namespaces for literals.
        * include/bits/regex.h (basic_regex, match_results): Add workarounds
        for PR c++/59256.
        * include/bits/uniform_int_dist.h: Fix nesting of versioned namespace.
        * include/std/chrono: Likewise.
        * include/std/complex: Likewise.
        * include/std/string_view: Likewise.
        * include/std/variant: Likewise. Add workaround for PR c++/59256.
        * include/experimental/bits/fs_fwd.h: Declare versioned namespace.
        * include/experimental/bits/lfts_config.h: Declare versioned
        namespaces.
        * include/experimental/algorithm: Include
        <experimental/bits/lfts_config.h>.
        * include/experimental/any: Likewise.
        * include/experimental/bits/erase_if.h: Likewise.
        * include/experimental/chrono: Likewise.
        * include/experimental/functional: Likewise.
        * include/experimental/memory_resource: Likewise.
        * include/experimental/optional: Likewise.
        * include/experimental/propagate_const: Likewise.
        * include/experimental/random: Likewise.
        * include/experimental/ratio: Likewise.
        * include/experimental/system_error: Likewise.
        * include/experimental/tuple: Likewise.
        * include/experimental/type_traits: Likewise.
        * include/experimental/utility: Likewise.
        * include/experimental/string_view: Likewise. Fix nesting of
        versioned namespaces.
        * include/experimental/bits/string_view.tcc: Reopen inline namespace
        for non-inline function definitions.
        * testsuite/17_intro/using_namespace_std_exp_neg.cc: New test.
        * testsuite/20_util/duration/literals/range.cc: Adjust dg-error line.
        * testsuite/experimental/any/misc/any_cast_neg.cc: Likewise.
        * testsuite/experimental/propagate_const/assignment/move_neg.cc:
        Likewise.
        * testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements2.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements3.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements4.cc: Likewise.
        * testsuite/experimental/propagate_const/requirements5.cc: Likewise.
        * testsuite/ext/profile/mutex_extensions_neg.cc: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240714 
138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver 
b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index 65866a3..34d58ae 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -187,6 +187,7 @@ CXXABI_2.0 {
     __cxa_guard_release;
     __cxa_pure_virtual;
     __cxa_rethrow;
+    __cxa_thread_atexit;
     __cxa_throw;
     __cxa_type_match;
     __cxa_vec_cctor;
@@ -344,6 +345,9 @@ CXXABI_2.0 {
     _ZdlPv[jmy];
     # operator delete[](void*, std::size_t)
     _ZdaPv[jmy];
+
+    # __gnu_cxx::__freeres()
+    _ZN9__gnu_cxx9__freeresEv;
 };
 
 # Symbols in the support library (libsupc++) supporting trans-mem.
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 4e63fbb..bb4a532 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -692,6 +692,7 @@ experimental_bits_srcdir = 
${glibcxx_srcdir}/include/experimental/bits
 experimental_bits_builddir = ./experimental/bits
 experimental_bits_headers = \
        ${experimental_bits_srcdir}/erase_if.h \
+       ${experimental_bits_srcdir}/lfts_config.h \
        ${experimental_bits_srcdir}/shared_ptr.h \
        ${experimental_bits_srcdir}/string_view.tcc \
        ${experimental_bits_filesystem_headers}
diff --git a/libstdc++-v3/include/bits/basic_string.h 
b/libstdc++-v3/include/bits/basic_string.h
index 7a4204e..b80e270 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -6091,6 +6091,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 #endif
 
+_GLIBCXX_END_NAMESPACE_VERSION
+
 #if __cplusplus > 201103L
 
 #define __cpp_lib_string_udls 201304
@@ -6099,6 +6101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   inline namespace string_literals
   {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     _GLIBCXX_DEFAULT_ABI_TAG
     inline basic_string<char>
@@ -6124,12 +6127,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return basic_string<char32_t>{__str, __len}; }
 #endif
 
+_GLIBCXX_END_NAMESPACE_VERSION
   } // inline namespace string_literals
   } // inline namespace literals
 
 #endif // __cplusplus > 201103L
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++11
diff --git a/libstdc++-v3/include/bits/c++config 
b/libstdc++-v3/include/bits/c++config
index 656ef78..6db66d7 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -187,8 +187,11 @@
     namespace placeholders { }
     namespace regex_constants { }
     namespace this_thread { }
-
-    namespace experimental { }
+    inline namespace literals {
+      inline namespace chrono_literals { }
+      inline namespace complex_literals { }
+      inline namespace string_literals { }
+    }
   }
 
   namespace abi { }
@@ -273,9 +276,16 @@ namespace std
   namespace regex_constants { inline namespace __7 { } }
   namespace this_thread { inline namespace __7 { } }
 
-  namespace experimental { inline namespace __7 { } }
+  inline namespace literals {
+    inline namespace chrono_literals { inline namespace __7 { } }
+    inline namespace complex_literals { inline namespace __7 { } }
+    inline namespace string_literals { inline namespace __7 { } }
+  }
 
-  namespace __detail { inline namespace __7 { } }
+  namespace __detail {
+    inline namespace __7 { }
+    namespace __variant { inline namespace __7 { } }
+  }
 }
 
 namespace __gnu_cxx
diff --git a/libstdc++-v3/include/bits/regex.h 
b/libstdc++-v3/include/bits/regex.h
index 4e87bc0..a7d45e6 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -769,10 +769,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
       template<typename _Bp, typename _Ap, typename _Cp, typename _Rp,
        __detail::_RegexExecutorPolicy, bool>
-       friend bool
-       __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
-                                   const basic_regex<_Cp, _Rp>&,
-                                   regex_constants::match_flag_type);
+       friend bool __detail::
+#if _GLIBCXX_INLINE_VERSION
+        __7:: // Required due to PR c++/59256
+#endif
+       __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
+                          const basic_regex<_Cp, _Rp>&,
+                          regex_constants::match_flag_type);
 
       template<typename, typename, typename, bool>
        friend class __detail::_Executor;
@@ -1860,10 +1863,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
       template<typename _Bp, typename _Ap, typename _Cp, typename _Rp,
        __detail::_RegexExecutorPolicy, bool>
-       friend bool
-       __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
-                                   const basic_regex<_Cp, _Rp>&,
-                                   regex_constants::match_flag_type);
+       friend bool __detail::
+#if _GLIBCXX_INLINE_VERSION
+        __7:: // Required due to PR c++/59256
+#endif
+       __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
+                          const basic_regex<_Cp, _Rp>&,
+                          regex_constants::match_flag_type);
 
       void
       _M_resize(unsigned int __size)
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h 
b/libstdc++-v3/include/bits/uniform_int_dist.h
index 06bc36e..2d668bc 100644
--- a/libstdc++-v3/include/bits/uniform_int_dist.h
+++ b/libstdc++-v3/include/bits/uniform_int_dist.h
@@ -36,10 +36,10 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   namespace __detail
   {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
     /* Determine whether number is a power of 2.  */
     template<typename _Tp>
       inline bool
@@ -47,8 +47,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
        return ((__x - 1) & __x) == 0;
       };
+_GLIBCXX_END_NAMESPACE_VERSION
   }
 
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   /**
    * @brief Uniform discrete distribution for random numbers.
    * A discrete random distribution on the range @f$[min, max]@f$ with equal
diff --git a/libstdc++-v3/include/experimental/algorithm 
b/libstdc++-v3/include/experimental/algorithm
index 9083c7f..0ba6311 100644
--- a/libstdc++-v3/include/experimental/algorithm
+++ b/libstdc++-v3/include/experimental/algorithm
@@ -37,6 +37,7 @@
 
 #include <algorithm>
 #include <random>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/any 
b/libstdc++-v3/include/experimental/any
index 96ad576..5e091a4 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -39,6 +39,7 @@
 #include <new>
 #include <utility>
 #include <type_traits>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/bits/erase_if.h 
b/libstdc++-v3/include/experimental/bits/erase_if.h
index b9aa637..0ed60aa 100644
--- a/libstdc++-v3/include/experimental/bits/erase_if.h
+++ b/libstdc++-v3/include/experimental/bits/erase_if.h
@@ -35,6 +35,7 @@
 #if __cplusplus <= 201103L
 # include <bits/c++14_warning.h>
 #else
+#include <experimental/bits/lfts_config.h>
 
 namespace std
 {
diff --git a/libstdc++-v3/include/experimental/bits/fs_fwd.h 
b/libstdc++-v3/include/experimental/bits/fs_fwd.h
index b9cc041..1c08b19 100644
--- a/libstdc++-v3/include/experimental/bits/fs_fwd.h
+++ b/libstdc++-v3/include/experimental/bits/fs_fwd.h
@@ -46,10 +46,13 @@ namespace filesystem
 {
 inline namespace v1
 {
+#if _GLIBCXX_INLINE_VERSION
+inline namespace __7 { }
+#endif
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if _GLIBCXX_USE_CXX11_ABI
-  inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
+inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
 #endif
 
   /**
diff --git a/libstdc++-v3/include/experimental/bits/lfts_config.h 
b/libstdc++-v3/include/experimental/bits/lfts_config.h
new file mode 100644
index 0000000..10e3687
--- /dev/null
+++ b/libstdc++-v3/include/experimental/bits/lfts_config.h
@@ -0,0 +1,60 @@
+// Namespace declarations for Library Fundamentals TS -*- C++ -*-
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/bits/lfts_config.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly.
+ */
+
+#if __cplusplus <= 201103L
+# include <bits/c++14_warning.h>
+#else
+#include <bits/c++config.h>
+
+#if _GLIBCXX_INLINE_VERSION
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace chrono
+{
+namespace experimental
+{
+inline namespace fundamentals_v1 { inline namespace __7 { } }
+inline namespace fundamentals_v2 { inline namespace __7 { } }
+} // namespace experimental
+} // namespace chrono
+
+namespace experimental
+{
+inline namespace fundamentals_v1 { inline namespace __7 { } }
+inline namespace fundamentals_v2 {
+  inline namespace __7 { }
+  namespace pmr { inline namespace __7 { } }
+} // namespace fundamentals_v2
+inline namespace literals { inline namespace string_view_literals {
+  inline namespace __7 { }
+} } // namespace literals::string_view_literals
+} // namespace experimental
+} // namespace std
+#endif
+#endif
diff --git a/libstdc++-v3/include/experimental/bits/string_view.tcc 
b/libstdc++-v3/include/experimental/bits/string_view.tcc
index 3a16c38..7c6b1be 100644
--- a/libstdc++-v3/include/experimental/bits/string_view.tcc
+++ b/libstdc++-v3/include/experimental/bits/string_view.tcc
@@ -44,6 +44,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 namespace experimental
 {
+inline namespace fundamentals_v1
+{
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits>
@@ -222,6 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
 _GLIBCXX_END_NAMESPACE_VERSION
+} // namespace fundamentals_v1
 } // namespace experimental
 } // namespace std
 
diff --git a/libstdc++-v3/include/experimental/chrono 
b/libstdc++-v3/include/experimental/chrono
index 30de1cf..e703d93 100644
--- a/libstdc++-v3/include/experimental/chrono
+++ b/libstdc++-v3/include/experimental/chrono
@@ -40,7 +40,7 @@
 #else
 
 #include <chrono>
-
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/functional 
b/libstdc++-v3/include/experimental/functional
index eddbcf1..082e58c 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -45,6 +45,7 @@
 #ifdef _GLIBCXX_PARALLEL
 # include <parallel/algorithm> // For std::__parallel::search
 #endif
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/memory_resource 
b/libstdc++-v3/include/experimental/memory_resource
index ea8afb8..39187c5 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -34,6 +34,7 @@
 #include <atomic>
 #include <cstddef>
 #include <bits/alloc_traits.h>
+#include <experimental/bits/lfts_config.h>
 
 namespace std {
 namespace experimental {
diff --git a/libstdc++-v3/include/experimental/optional 
b/libstdc++-v3/include/experimental/optional
index ea8f6fb..7191eca 100644
--- a/libstdc++-v3/include/experimental/optional
+++ b/libstdc++-v3/include/experimental/optional
@@ -53,6 +53,7 @@
 #include <bits/functexcept.h>
 #include <bits/functional_hash.h>
 #include <bits/enable_special_members.h>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/propagate_const 
b/libstdc++-v3/include/experimental/propagate_const
index 75cd8c0a..15ffe4a 100644
--- a/libstdc++-v3/include/experimental/propagate_const
+++ b/libstdc++-v3/include/experimental/propagate_const
@@ -37,6 +37,7 @@
 
 #include <type_traits>
 #include <functional>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/random 
b/libstdc++-v3/include/experimental/random
index 370390a..039e45f 100644
--- a/libstdc++-v3/include/experimental/random
+++ b/libstdc++-v3/include/experimental/random
@@ -30,6 +30,7 @@
 #define _GLIBCXX_EXPERIMENTAL_RANDOM 1
 
 #include <random>
+#include <experimental/bits/lfts_config.h>
 
 namespace std {
 namespace experimental {
diff --git a/libstdc++-v3/include/experimental/ratio 
b/libstdc++-v3/include/experimental/ratio
index 8ab45c1..d55f6ae 100644
--- a/libstdc++-v3/include/experimental/ratio
+++ b/libstdc++-v3/include/experimental/ratio
@@ -40,7 +40,7 @@
 #else
 
 #include <ratio>
-
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -49,6 +49,7 @@ namespace experimental
 inline namespace fundamentals_v1
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // See C++14 §20.11.5, ratio comparison
 template <typename _R1, typename _R2>
   constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
diff --git a/libstdc++-v3/include/experimental/string_view 
b/libstdc++-v3/include/experimental/string_view
index 7a89d44..8cb8c1f 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -41,6 +41,7 @@
 
 #include <string>
 #include <limits>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -651,13 +652,12 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 namespace experimental
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
   // I added these EMSR.
   inline namespace literals
   {
   inline namespace string_view_literals
   {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     inline constexpr basic_string_view<char>
     operator""sv(const char* __str, size_t __len)
@@ -679,10 +679,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return basic_string_view<char32_t>{__str, __len}; }
 #endif
 
-  }
-  }
-
-_GLIBCXX_END_NAMESPACE_VERSION
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace string_literals
+  } // namespace literals
 } // namespace experimental
 } // namespace std
 
diff --git a/libstdc++-v3/include/experimental/system_error 
b/libstdc++-v3/include/experimental/system_error
index 8654951..5b286ee 100644
--- a/libstdc++-v3/include/experimental/system_error
+++ b/libstdc++-v3/include/experimental/system_error
@@ -40,7 +40,7 @@
 #else
 
 #include <system_error>
-
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -49,12 +49,14 @@ namespace experimental
 inline namespace fundamentals_v1
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // See C++14 §19.5, System error support
 template <typename _Tp>
   constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value;
 template <typename _Tp>
   constexpr bool is_error_condition_enum_v =
     is_error_condition_enum<_Tp>::value;
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace fundamentals_v1
 } // namespace experimental
diff --git a/libstdc++-v3/include/experimental/tuple 
b/libstdc++-v3/include/experimental/tuple
index b653ea7..dc158e8 100644
--- a/libstdc++-v3/include/experimental/tuple
+++ b/libstdc++-v3/include/experimental/tuple
@@ -36,7 +36,9 @@
 #else
 
 #include <tuple>
+#include <functional>
 #include <bits/invoke.h>
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/type_traits 
b/libstdc++-v3/include/experimental/type_traits
index a21fcd8..06f1023 100644
--- a/libstdc++-v3/include/experimental/type_traits
+++ b/libstdc++-v3/include/experimental/type_traits
@@ -40,7 +40,7 @@
 #else
 
 #include <type_traits>
-
+#include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/utility 
b/libstdc++-v3/include/experimental/utility
index 8948e93..77a161e 100644
--- a/libstdc++-v3/include/experimental/utility
+++ b/libstdc++-v3/include/experimental/utility
@@ -31,6 +31,7 @@
 
 #include <utility>
 #include <bits/uses_allocator.h>
+#include <experimental/bits/lfts_config.h>
 
 namespace std {
 namespace experimental {
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 11e7fa2..cb8c876 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -881,6 +881,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
   {
   inline namespace chrono_literals
   {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     template<typename _Rep, unsigned long long _Val>
       struct _Checked_integral_constant
@@ -956,6 +957,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
       operator""ns()
       { return __check_overflow<chrono::nanoseconds, _Digits...>(); }
 
+  _GLIBCXX_END_NAMESPACE_VERSION
   } // inline namespace chrono_literals
   } // inline namespace literals
 
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index bb09b7d..a682247 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -1932,10 +1932,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     conj(_Tp __x)
     { return __x; }
 
+_GLIBCXX_END_NAMESPACE_VERSION
+
 #if __cplusplus > 201103L
 
 inline namespace literals {
 inline namespace complex_literals {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #define __cpp_lib_complex_udls 201309
 
@@ -1963,12 +1966,12 @@ inline namespace complex_literals {
   operator""il(unsigned long long __num)
   { return std::complex<long double>{0.0L, static_cast<long double>(__num)}; }
 
+_GLIBCXX_END_NAMESPACE_VERSION
 } // inline namespace complex_literals
 } // inline namespace literals
 
 #endif // C++14
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
 #endif  // C++11
diff --git a/libstdc++-v3/include/std/string_view 
b/libstdc++-v3/include/std/string_view
index d78ed02..14bfcd0 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -427,10 +427,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       size_t       _M_len;
       const _CharT* _M_str;
     };
-
+_GLIBCXX_END_NAMESPACE_VERSION
 
   // [string.view.comparison], non-member basic_string_view comparison function
- _GLIBCXX_END_NAMESPACE_VERSION
   namespace __detail
   {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -445,8 +444,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     template<typename _Tp>
       using __idt = typename __identity<_Tp>::type;
- _GLIBCXX_END_NAMESPACE_VERSION
+_GLIBCXX_END_NAMESPACE_VERSION
   }
+
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits>
@@ -639,8 +639,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __is_fast_hash<hash<u32string_view>> : std::false_type
     { };
 #endif
-_GLIBCXX_END_NAMESPACE_VERSION
-
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index ac483f3..48baf9a 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -85,10 +85,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   constexpr size_t variant_npos = -1;
 
+_GLIBCXX_END_NAMESPACE_VERSION
+
 namespace __detail
 {
 namespace __variant
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Returns the first apparence of _Tp in _Types.
   // Returns sizeof...(_Types) if _Tp is not in _Types.
   template<typename _Tp, typename... _Types>
@@ -725,9 +728,12 @@ namespace __variant
       }
     };
 
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __variant
 } // namespace __detail
 
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   template<typename _Tp, typename... _Types>
     inline constexpr bool holds_alternative(const variant<_Types...>& __v)
     noexcept
@@ -1250,7 +1256,11 @@ namespace __variant
       }
 
       template<typename _Vp>
-       friend void* __detail::__variant::__get_storage(_Vp&& __v);
+       friend void* __detail::__variant::
+#if _GLIBCXX_INLINE_VERSION
+        __7:: // Required due to PR c++/59256
+#endif
+        __get_storage(_Vp&& __v);
     };
 
   // To honor algebraic data type, variant<> should be a bottom type, which
diff --git a/libstdc++-v3/testsuite/17_intro/using_namespace_std_exp_neg.cc 
b/libstdc++-v3/testsuite/17_intro/using_namespace_std_exp_neg.cc
new file mode 100644
index 0000000..22196e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/using_namespace_std_exp_neg.cc
@@ -0,0 +1,65 @@
+// { dg-do compile { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <algorithm>
+#include <array>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <random>
+#include <regex>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <tuple>
+#include <typeinfo>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <vector>
+
+namespace gnu
+{
+  using namespace std::experimental;  // { dg-error "is not a namespace-name" }
+}
+
+// { dg-error "expected namespace-name before" "" { target *-*-* } 62 }
diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc 
b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
index e3ef7f9..4ade327 100644
--- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
@@ -26,5 +26,5 @@ test01()
 
   // std::numeric_limits<int64_t>::max() == 9223372036854775807;
   auto h = 9223372036854775808h;
-  // { dg-error "cannot be represented" "" { target *-*-* } 889 }
+  // { dg-error "cannot be represented" "" { target *-*-* } 890 }
 }
diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc 
b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
index abd9562..4310572 100644
--- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
@@ -25,5 +25,5 @@ void test01()
   using std::experimental::any_cast;
 
   const any y(1);
-  any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 368 }
+  any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 369 }
 }
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
index ebc9ae0..1b0366d 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
@@ -25,7 +25,7 @@
 using std::experimental::propagate_const;
 using std::unique_ptr;
 
-// { dg-error "no type" "" { target *-*-* } 158 }
+// { dg-error "no type" "" { target *-*-* } 159 }
 
 int main()
 {
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
index 4bba8cd..ffdc756 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
@@ -25,10 +25,10 @@
 using std::experimental::propagate_const;
 using std::unique_ptr;
 
-// { dg-error "no type" "" { target *-*-* } 117 }
-// { dg-error "no type" "" { target *-*-* } 124 }
-// { dg-error "no type" "" { target *-*-* } 133 }
-// { dg-error "no type" "" { target *-*-* } 142 }
+// { dg-error "no type" "" { target *-*-* } 118 }
+// { dg-error "no type" "" { target *-*-* } 125 }
+// { dg-error "no type" "" { target *-*-* } 134 }
+// { dg-error "no type" "" { target *-*-* } 143 }
 
 int main()
 {
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
index 091a0e1..de2d293 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
@@ -21,9 +21,9 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 104 }
-// { dg-error "not a pointer-to-object type" "" { target *-*-* } 65 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 184 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 210 }
+// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 105 }
+// { dg-error "not a pointer-to-object type" "" { target *-*-* } 66 }
+// { dg-error "forming pointer to reference type" "" { target *-*-* } 185 }
+// { dg-error "forming pointer to reference type" "" { target *-*-* } 211 }
 
 propagate_const<void*> test1;
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
index 156171b..fd25204 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
@@ -21,6 +21,6 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 104 }
+// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 105 }
 
 propagate_const<void (*)()> test1;
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
index 682355f..3cea93d 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
@@ -21,8 +21,8 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 104 }
-// { dg-error "invalid type" "" { target *-*-* } 65 }
-// { dg-error "uninitialized reference member" "" { target *-*-* } 111 }
+// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 105 }
+// { dg-error "invalid type" "" { target *-*-* } 66 }
+// { dg-error "uninitialized reference member" "" { target *-*-* } 112 }
 
 propagate_const<int&> test1; // { dg-error "use of deleted function" }
diff --git 
a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc 
b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
index 67e92b4..9740fc3 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
@@ -21,6 +21,6 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 104 }
+// { dg-error "requires a class or a pointer to an object type" "" { target 
*-*-* } 105 }
 
 propagate_const<int[1]> test1;
diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc 
b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
index 874f3de..20bc198 100644
--- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
+++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
@@ -25,7 +25,7 @@
 
 #include <vector>
 
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 332 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 342 }
 
 // "template argument 1 is invalid"
 // { dg-prune-output "tuple:993" }

Reply via email to