https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100630

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-05-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Romain Geissler from comment #0)
> Hi,
> 
> I came across this issue today (which I think is unexpected) with gcc 8, 9
> and 10. It seems that the following code triggers some implicit conversion
> from volatile bool& to std::filesystem::path while this was definitely not
> the intention:

It's not triggering such a conversion, it's checking if such a conversion is
viable as part of overload resolution. But then that instantiates something
that is ill-formed and fails with an error outside the immediate context.

I think the right fix for the branches is:


--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -116,7 +116,7 @@ namespace __detail

   template<typename _Source>
     struct __constructible_from<_Source, void>
-    : decltype(__is_path_src(std::declval<_Source>(), 0))
+    : decltype(__is_path_src(std::declval<const _Source&>(), 0))
     { };

   template<typename _Tp1, typename _Tp2 = void>

Reply via email to