From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 518093858D20 for ; Fri, 2 Dec 2022 08:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 518093858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x434.google.com with SMTP id z14so374729pfr.11 for ; Fri, 02 Dec 2022 00:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=sInoW7BEDxyiBbZKUhBfV11aP+xZeXz2mruGwUJhSjw=; b=H34DpMzGCsaWE2qwC/I0ojpYdsuXEW83mDH4qLdymlChueBIDZbb2K7SmcRqL7bbsQ W4GdWsxsOyKo9lhhyVbzbv4uI4YcKjSxb8IcxRGWCaXOKucV0IyAieu0F6KaWSj9mzI/ pQw4ruHHgOEbkRht53qJyWyxcTJCFbt7IZPvextNUr44JJW+qOc7xft7d4U4kk25CBAL aeHwi+HS4kHhwnZF2xebB0qH/9JeKeYf81gF+uWmMH51uhYN59HFT08Uhm4LuUscIHh+ AIDDvy9RWzUGjjg686kchKNqoi/v4lOxnWm1sl163Vyuu6fgGeG00EoWNzkc2VsVDy/I uzjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sInoW7BEDxyiBbZKUhBfV11aP+xZeXz2mruGwUJhSjw=; b=VX15dQ+DCLFF3B0WsEfcbt8Ix9n+HXau0dv/Ksi4J0cSwGScOfChvHBd7wvKhmOAFA zji0Hi3RDmOQ2LFpTCAk2ze8E96TV/oPhCImhqZQdPz9+HslpUiQloWePvVHCTnYbVjZ A5VLEMIAyUGSJy++eDti2AQYC/gFmsIArxT30wsjz31c+qwwqG+6Hspdnozo5QzQm9SP 8H6gQrF+fcTmrrPBWrQFyqVVZCX6ILxnbqOhUtmzS+7XsG4h2uvKs9iggVXU1QzzW79M eKnr/wYHbu0ZE+wC3po/m+IUPGkKCpC0JilB9GQsVAcSeipIMBuVOnZ3CpRguTd4ZAXb Iekw== X-Gm-Message-State: ANoB5plB0Cht8iRIRRlbGKNh3e/tSofrCox8d3WguvBkZdYEaCzIngeE aDOsgsmAxq8YmI1u9LMniHXiUsimfm58o5lrPUdWvNgUWPY= X-Google-Smtp-Source: AA0mqf7jeFbFFQDKNTAwdkKaM9Xj6dI66Oja0FoZ3uW0/54v+RIQdLBEqlfcZLiR1uz3ep2fY/BBS0mD+PmjeDPpq2k= X-Received: by 2002:a05:6a00:1a4c:b0:574:97d4:c10f with SMTP id h12-20020a056a001a4c00b0057497d4c10fmr39548796pfv.81.1669970107234; Fri, 02 Dec 2022 00:35:07 -0800 (PST) MIME-Version: 1.0 References: <81026ee4-8f45-3d45-57ca-a9abed92c722@126.com> <69b994c3-b1e2-6752-4bc0-5d706bfc0da3@126.com> In-Reply-To: <69b994c3-b1e2-6752-4bc0-5d706bfc0da3@126.com> From: leon zadorin Date: Fri, 2 Dec 2022 19:34:55 +1100 Message-ID: Subject: Re: which compiler is right (either to compile or to barf)... To: gcc-help Content-Type: multipart/alternative; boundary="000000000000071ad705eed437c7" X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000071ad705eed437c7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 2, 2022 at 6:45 PM LIU Hao wrote: > =E5=9C=A8 2022/12/2 15:18, leon zadorin via Gcc-help =E5=86=99=E9=81=93: > > (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', 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>> 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 :) --000000000000071ad705eed437c7--