I got a report that Clang fails to compile the filesystem lib, with
the following error:

/home/jwakely/gcc/latest/include/c++/6.0.0/experimental/bits/fs_path.h:563:18: fatal 
error: explicit specialization of 
'std::experimental::filesystem::v1::path::__is_encoded_char<char>' after 
instantiation
   struct path::__is_encoded_char<char> : std::true_type
                ^~~~~~~~~~~~~~~~~~~~~~~
/home/jwakely/gcc/latest/include/c++/6.0.0/experimental/bits/fs_path.h:104:9: 
note: implicit instantiation first required here
     : decltype(__is_path_src(std::declval<_Source>(), 0))
       ^

The problem is that the path::_Cmpt constructors do overload
resolution on the path constructors, which requires the explicit
specializations of __is_encoded_char. Solved by moving the definition
of _Cmpt after the specializations.

I'm still reducing it to report a g++ bug for the missed diagnostic.

Tested powerpc64le-linux, committed to trunk. This is unfortunately
too late for 5.3, so I'll fix it on the branch when it reopens.


commit 0bd97117b71c759cbccfe9d19ea09b96c3bce472
Author: Jonathan Wakely <[email protected]>
Date:   Tue Dec 1 10:30:31 2015 +0000

    Define path::_Cmpt after specializing path::__is_encoded_char
    
    	* include/experimental/bits/fs_path.h (path::_Cmpt): Move definition
    	after path::__is_encoded_char explicit specializations.

diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index 40462a6..98820ad 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -549,16 +549,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
     std::string _M_what = _M_gen_what();
   };
 
-  struct path::_Cmpt : path
-  {
-    _Cmpt(string_type __s, _Type __t, size_t __pos)
-      : path(std::move(__s), __t), _M_pos(__pos) { }
-
-    _Cmpt() : _M_pos(-1) { }
-
-    size_t _M_pos;
-  };
-
   template<>
     struct path::__is_encoded_char<char> : std::true_type
     { using value_type = char; };
@@ -575,6 +565,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
     struct path::__is_encoded_char<char32_t> : std::true_type
     { using value_type = char32_t; };
 
+  struct path::_Cmpt : path
+  {
+    _Cmpt(string_type __s, _Type __t, size_t __pos)
+      : path(std::move(__s), __t), _M_pos(__pos) { }
+
+    _Cmpt() : _M_pos(-1) { }
+
+    size_t _M_pos;
+  };
+
   // specialize _Cvt for degenerate 'noconv' case
   template<>
     struct path::_Cvt<path::value_type>

Reply via email to