From: leon zadorin <leonleon77@gmail.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: which compiler is right (either to compile or to barf)...
Date: Fri, 2 Dec 2022 19:34:55 +1100 [thread overview]
Message-ID: <CAPpySAZT2NO0My+YA_+2D0-ZWbHgWjxw+weKiJ6Hg-2_96prEw@mail.gmail.com> (raw)
In-Reply-To: <69b994c3-b1e2-6752-4bc0-5d706bfc0da3@126.com>
[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]
On Fri, Dec 2, 2022 at 6:45 PM LIU Hao <lh_mouse@126.com> wrote:
> 在 2022/12/2 15:18, leon zadorin via Gcc-help 写道:
> > (1) On the one hand, given that I do instantiate ::std::optional with S
> > (whith has member v whose elements' types, I guess(?) are at the line of
> > declaring 'static ::std::optional<S> s', are still incompletely denifed,
> > i.e. X) -- the clang discussion appears to say that at this moment
> optional
> > is instantiated and S is incomplete (?) ... as so it is a UB... which I
> > understood Jonathan's comment to relate to as well.
> >
>
> Yes this requires `S` to be complete.
>
...
>
> Only `S` itself is required to be complete.
>
>
> In your code:
>
> struct S {
> ::std::vector<::std::shared_ptr<J<X>>> v;
> };
>
> `S` _is_ complete. It does not matter whether it contains a `vector` of or
> a `shared_ptr` to
> incomplete types, because the standard allows so. ([vector.overview] 4,
> [util.smartptr.shared] 2)
>
ah..., ok -- thanks very much for explaining! If that is the case then
indeed you are correct -- there is no UB it would seem (I had updated the
comment in clang discussion
https://github.com/llvm/llvm-project/issues/59292#issuecomment-1334898870 ,
hopefully they may re-open the issue then :) . Many thanks for clarifying
:)
next prev parent reply other threads:[~2022-12-02 8:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 4:51 leon zadorin
2022-12-01 9:35 ` LIU Hao
2022-12-01 23:26 ` leon zadorin
2022-12-01 23:54 ` Jonathan Wakely
2022-12-01 23:56 ` Jonathan Wakely
2022-12-02 0:17 ` leon zadorin
2022-12-02 6:37 ` LIU Hao
2022-12-02 7:18 ` leon zadorin
2022-12-02 7:22 ` leon zadorin
2022-12-02 7:45 ` LIU Hao
2022-12-02 8:34 ` leon zadorin [this message]
2022-12-02 9:16 ` leon zadorin
2022-12-02 10:50 ` leon zadorin
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=CAPpySAZT2NO0My+YA_+2D0-ZWbHgWjxw+weKiJ6Hg-2_96prEw@mail.gmail.com \
--to=leonleon77@gmail.com \
--cc=gcc-help@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).