public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/100577] New: [11/12 Regression] Unhelpful diagnostics for ill-formed call to partially applied range adaptor object
Date: Thu, 13 May 2021 02:16:25 +0000	[thread overview]
Message-ID: <bug-100577-4@http.gcc.gnu.org/bugzilla/> (raw)

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;
      |         ^~~~~~~~

             reply	other threads:[~2021-05-13  2:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  2:16 ppalka at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100577-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).