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 c++/92894] "declared using local type 'test01()::X', is used but never defined" during concept satisfaction
Date: Fri, 01 May 2020 02:43:18 +0000	[thread overview]
Message-ID: <bug-92894-4-7PIaDgMwLZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92894-4@http.gcc.gnu.org/bugzilla/>

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> The following should compile, because the undefined member function is never
> odr-used, only its return type is needed.

Hmm.. don't we end up odr-using the undefined member function when checking the 

   { ranges::iter_move(__in) } -> same_as<iter_rvalue_reference_t<_In>>;

requirement of the concept __indirectly_readable_impl (as part of the concept
indirect_unary_predicate)?

In order to verify this requirement we need to determine the return type of
ranges::iter_move(__in).  But the operator() of this CPO has a decltype(auto)
return type, so determining its return type requires instantiating its body:

      struct _IMove
      {
        template<typename _Tp>
          requires __adl_imove<_Tp> || requires(_Tp& __e) { *__e; }
          constexpr _Blah<_Tp>::type
          operator()(_Tp&& __e) const
          noexcept(_S_noexcept<_Tp>())
          {
            if constexpr (__adl_imove<_Tp>)
              return iter_move(static_cast<_Tp&&>(__e));
            else if constexpr (is_reference_v<iter_reference_t<_Tp>>)
              return std::move(*__e);
            else
              return *__e;
          }
      };

And this instantiated function body (the second branch of the constexpr if)
would then odr-use this undefined member function, IIUC.

So could this be another example where defining the operator() of a CPO with a
deduced return type leads to excessive instantiation?

  parent reply	other threads:[~2020-05-01  2:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-92894-4@http.gcc.gnu.org/bugzilla/>
2020-03-20 21:07 ` redi at gcc dot gnu.org
2020-03-20 21:08 ` redi at gcc dot gnu.org
2020-05-01  2:43 ` ppalka at gcc dot gnu.org [this message]
2020-05-01  2:53 ` ppalka at gcc dot gnu.org
2020-05-01  8:07 ` redi at gcc dot gnu.org
2020-05-01 10:35 ` [Bug libstdc++/92894] " redi at gcc dot gnu.org
2020-05-01 13:28 ` cvs-commit at gcc dot gnu.org
2020-05-01 15:52 ` redi at gcc dot gnu.org
2020-05-07 11:56 ` jakub at gcc dot gnu.org
2020-05-07 20:07 ` cvs-commit at gcc dot gnu.org
2020-05-07 20:08 ` redi 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-92894-4-7PIaDgMwLZ@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).