public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100577] New: [11/12 Regression] Unhelpful diagnostics for ill-formed call to partially applied range adaptor object
@ 2021-05-13  2:16 ppalka at gcc dot gnu.org
  2021-05-13  2:19 ` [Bug libstdc++/100577] " ppalka at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-13  2:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100577
           Summary: [11/12 Regression] Unhelpful diagnostics for
                    ill-formed call to partially applied range adaptor
                    object
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

For the following invalid testcase:

#include <ranges>

int main() {
  extern int x[100];
  std::views::take(nullptr)(x);
}

GCC 10 emits the following errors:

In file included from <stdin>:1:                                                
/usr/include/c++/10/ranges: In instantiation of
‘std::ranges::views::<lambda(_Range&&, _Tp&&)> [with _Range = int (&)[100]; _Tp
= std::nullptr_t]’:                                                             
/usr/include/c++/10/ranges:1142:27:   required from
‘std::ranges::views::__adaptor::_RangeAdaptor<_Callable>::operator()<{std::nullptr_t}>::<lambda(_Range&&)>
[with _Range = int (&)[100]]’                       
/usr/include/c++/10/ranges:1162:44:   required from ‘constexpr auto
std::ranges::views::__adaptor::_RangeAdaptorClosure<_Callable>::operator()(_Range&&)
const [with _Range = int (&)[100]; _Callable = std::ranges
::views::__adaptor::_RangeAdaptor<_Callable>::operator()<{std::nullptr_t}>::<lambda(_Range&&)>]’ 
<stdin>:5:30:   required from here                                              
/usr/include/c++/10/ranges:2148:68: error: class template argument deduction
failed:                                                                         
 2148 |  return take_view{std::forward<_Range>(__r), std::forward<_Tp>(__n)};   
      |                                                                    ^    
/usr/include/c++/10/ranges:2148:68: error: no matching function for call to
‘take_view(int [100], std::nullptr_t)’                                         
                                                       [...]
/usr/include/c++/10/ranges:2140:5: note: candidate:
‘std::ranges::take_view(_Range&&, std::ranges::range_difference_t<_Range>)->
std::ranges::take_view<std::ranges::views::all_t<_Range> > [with _Range = int
(&)[
100]; std::ranges::views::all_t<_Range> = std::ranges::ref_view<int [100]>;
std::ranges::range_difference_t<_Range> = long int]’                            
 2140 |     take_view(_Range&&, range_difference_t<_Range>)                     
      |     ^~~~~~~~~                                                           


Whereas GCC 11, after r11-8053, emits an almost useless error:

<stdin>:5:28: error: use of deleted function ‘constexpr auto
std::ranges::views::__adaptor::_Partial<_Adaptor, _Arg>::operator()(_Range&&)
const && [with _Range = int (&)[100]; _Adaptor = std::ranges::views::_Take;
_Arg = std::nullptr_t]’
In file included from <stdin>:1:
/home/patrick/code/gcc-master/libstdc++-v3/include/std/ranges:865:9: note:
declared here
  865 |         operator()(_Range&& __r) const && = delete;
      |         ^~~~~~~~

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-10 21:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  2:16 [Bug libstdc++/100577] New: [11/12 Regression] Unhelpful diagnostics for ill-formed call to partially applied range adaptor object ppalka at gcc dot gnu.org
2021-05-13  2:19 ` [Bug libstdc++/100577] " ppalka at gcc dot gnu.org
2021-05-13  3:04 ` ppalka at gcc dot gnu.org
2021-05-13  3:12 ` ppalka at gcc dot gnu.org
2021-06-03 13:50 ` cvs-commit at gcc dot gnu.org
2021-06-10 21:29 ` cvs-commit at gcc dot gnu.org
2021-06-10 21:39 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).