[Bug c++/120318] Module deduced return type error.

2025-05-21 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120318

--- Comment #3 from Patrick Palka  ---
Probably not very useful but here's a mechanically reduced testcase (fixed by
r16-504):

$ cat std.ii
module;
   
16:56 [38/1494]
namespace std { 
template  auto declval() -> decltype(0);
template  void forward() {}   
template
concept convertible_to = requires { declval; }; 
template  
concept move_constructible = convertible_to<_Tp, _Tp>;   
namespace ranges {  
inline namespace _Cpo {}
} // namespace ranges   
namespace __detail {
template  using __iter_concept = _Iter;
}   
template
concept input_iterator = requires { typename __detail::__iter_concept<_Iter>;
};
namespace ranges {  
namespace _Cpo {
int end;
}   
template  
concept range = requires { end; };  
template  
concept input_range = input_iterator<_Tp>;  
template  
concept viewable_range = range<_Tp>;
} // namespace ranges   
struct vector {};   
namespace ranges {  
template   
concept __adaptor_invocable = requires { declval<_Adaptor>; };
template  struct _Partial;
template  
concept __is_range_adaptor_closure = requires(_Tp __t) { __t; };
template
  requires __is_range_adaptor_closure<_Self> && 
   __adaptor_invocable<_Self, _Range>   
constexpr auto operator|(_Range &&, _Self &&) {}
template  struct _RangeAdaptorClosure {
  template 
requires __is_range_adaptor_closure<_Self> &&
 __adaptor_invocable<_Self, _Range>
  friend constexpr auto operator|(_Range &&, _Self &&);
};  
struct _RangeAdaptor {  
  template  auto operator()(_Args...) {
return _Partial{0, forward<_Args>...};
  } 
};  
template 
struct _Partial<_Adaptor, _Arg> : _RangeAdaptorClosure<_Arg> {
  template  _Partial(int, _Tp) {}
};  
namespace views {   
_RangeAdaptorClosure all;
template  using all_t = decltype(all);
} // namespace views
template  class transform_view;
template 
transform_view() -> transform_view, _Fp>;
namespace views {   
namespace __detail {
template 
concept __can_transform_view = requires { transform_view(declval); };
} // namespace __detail 
struct _Transform : _RangeAdaptor {
  template 
requires __detail::__can_transform_view<_Range, _Fp>
  auto operator0(); 
} inline transform; 
} // namespace views
} // namespace ranges   
} // namespace std  
export module std;  
export namespace std {  
namespace ranges {  
namespace views {   
using views::transform; 
}   
} // namespace ranges   
using std::vector;  
} // namespace std  

$ cat 120318.C
import std; 
using std::vector;  
using std::ranges::views::transform;
int main(int argl,char**argv)
{   
vector v;   
v | transform([](int x){return x * x % 24;});
return 0;   
}

[Bug c++/120318] Module deduced return type error.

2025-05-20 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120318

Patrick Palka  changed:

   What|Removed |Added

   Keywords|needs-bisection |
  Known to work||16.0
 CC||jason at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
  Known to fail||15.1.1
   Last reconfirmed||2025-05-20

--- Comment #2 from Patrick Palka  ---
Fixed on trunk by r16-504-g3c7c2a6b86da64 "c++: visibility of instantiated
template friends", perhaps the fix is suitable for backporting?

[Bug c++/120318] Module deduced return type error.

2025-05-17 Thread nshead at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120318

Nathaniel Shead  changed:

   What|Removed |Added

   Keywords||needs-bisection
 CC||nshead at gcc dot gnu.org

--- Comment #1 from Nathaniel Shead  ---
This compiles fine on trunk, but errors on 15.  I'm not sure what fixed the
bug; r16-652-g9694bb129c0dbf seemed likely but reverting it locally didn't
cause trunk to error.