public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Implement LWG 2762 for std::unique_ptr::operator*
Date: Thu, 24 Jun 2021 20:29:05 +0100	[thread overview]
Message-ID: <CACb0b4n8mbRU7Yfu8npYuxzM76SJHb1f49CbdQa6DExXd4sEwQ@mail.gmail.com> (raw)
In-Reply-To: <82f170be-4968-cae2-f775-c863096b5f@idea>

On Thu, 24 Jun 2021 at 19:54, Patrick Palka <ppalka@redhat.com> wrote:
>
> On Thu, 24 Jun 2021, Jonathan Wakely via Libstdc++ wrote:
>
> > The LWG issue proposes to add a conditional noexcept-specifier to
> > std::unique_ptr's dereference operator. The issue is currently in
> > Tentatively Ready status, but even if it isn't voted into the draft, we
> > can do it as a conforming extensions. This commit also adds a similar
> > noexcept-specifier to operator[] for the unique_ptr<T[], D> partial
> > specialization.
>
> The conditional noexcept added to unique_ptr<T[]>::operator[] seems to break
> the case where T is complete only after the fact:
>
>   struct T;
>   extern std::unique_ptr<T[]> p;
>   auto& t = p[1];
>   struct T { };
>
> /include/c++/12.0.0/bits/unique_ptr.h: In instantiation of ‘typename std::add_lvalue_reference<_Tp>::type std::unique_ptr<_Tp [], _Dp>::operator[](std::size_t) co
> nst [with _Tp = A; _Dp = std::default_delete<A []>; typename std::add_lvalue_reference<_Tp>::type = A&; std::size_t = long unsigned int]’:
> testcase.cc:5:14:   required from here
> /include/c++/12.0.0/bits/unique_ptr.h:658:48: error: invalid use of incomplete type ‘struct A’
>   658 |       noexcept(noexcept(std::declval<pointer>()[std::declval<size_t&>()]))
>       |                         ~~~~~~~~~~~~~~~~~~~~~~~^
> testcase.cc:3:8: note: forward declaration of ‘struct A’
>     3 | struct A;
>       |        ^

OK, I'll remove that again.


  reply	other threads:[~2021-06-24 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 13:10 Jonathan Wakely
2021-06-24 18:53 ` Patrick Palka
2021-06-24 19:29   ` Jonathan Wakely [this message]
2021-06-24 21:10   ` Tim Song
2021-06-28 14:19     ` Jonathan Wakely

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=CACb0b4n8mbRU7Yfu8npYuxzM76SJHb1f49CbdQa6DExXd4sEwQ@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /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).