diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.h b/libstdc++-v3/include/bits/regex_grep_matcher.h
index d9270e5..474d8a2 100644
--- a/libstdc++-v3/include/bits/regex_grep_matcher.h
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.h
@@ -252,20 +252,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     std::map<_StateIdT, std::unique_ptr<_Results>>     _M_current;
   };
 
-  std::unique_ptr<_Grep_matcher> _Nfa::
-  _M_get_matcher(_PatternCursor&                   __p,
-                 _Results&                         __r,
-                 const _AutomatonPtr&              __a,
-                 regex_constants::match_flag_type  __flags)
-  {
-    if (_M_has_back_ref)
-      return unique_ptr<_Grep_matcher>(
-        new _DFSMatcher(__p, __r, __a, __flags));
-    else
-      return unique_ptr<_Grep_matcher>(
-        new _BFSMatcher(__p, __r, __a, __flags));
-  }
-
  //@} regex-detail
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __detail
diff --git a/libstdc++-v3/include/bits/regex_grep_matcher.tcc b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
index 2cfc790..bafde77 100644
--- a/libstdc++-v3/include/bits/regex_grep_matcher.tcc
+++ b/libstdc++-v3/include/bits/regex_grep_matcher.tcc
@@ -101,6 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   // The SPFA approach.
+  inline
   void _BFSMatcher::
   _M_e_closure()
   {
@@ -162,6 +163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
   }
 
+  inline
   void _BFSMatcher::
   _M_move()
   {
@@ -178,6 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _M_current = move(__next);
   }
 
+  inline
   bool _BFSMatcher::
   _M_match_less_than(_StateIdT __u, _StateIdT __v) const
   {
@@ -189,6 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     return true;
   }
 
+  inline
   bool _BFSMatcher::
   _M_includes_some() const
   {
@@ -214,6 +218,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     return false;
   }
 
+  inline
+  std::unique_ptr<_Grep_matcher> _Nfa::
+  _M_get_matcher(_PatternCursor&                   __p,
+                 _Results&                         __r,
+                 const _AutomatonPtr&              __a,
+                 regex_constants::match_flag_type  __flags)
+  {
+    if (_M_has_back_ref)
+      return unique_ptr<_Grep_matcher>(
+        new _DFSMatcher(__p, __r, __a, __flags));
+    else
+      return unique_ptr<_Grep_matcher>(
+        new _BFSMatcher(__p, __r, __a, __flags));
+  }
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __detail
 } // namespace
