From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 96BFE3858D32 for ; Fri, 2 Dec 2022 00:17:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 96BFE3858D32 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-pg1-x52e.google.com with SMTP id 82so3104337pgc.0 for ; Thu, 01 Dec 2022 16:17:51 -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=M/J8cyPJt4Ll9RZS948MXK6mAeXy+ZI4TTtagozWqOU=; b=Svj//m1QzNGZBU80hiFrIJ7K+qRg09GsJmj4I7BsxBa2by0neFSx8DCdPGLsm0PsWU fFjjpcpU+oNEA9D2H6dWcQlmje1uUT4sQfWq7xtreWrUtHYG0QfuJozIXF3G7+00akJV VtD1RjX0RzcG6vc0PTx12I11qk0juQQhWzSAu0xQVoGXF2XlERDvm7vcUZ+0vRCDG+5H Mjwbq/p/YrasLTMnItyByzhOylryilblR6oyx1exX79M/3smIGsqt4fvLVe68pbGgemv hCKjYXNJoz7IkzzjP4fpEVNXE2UcNpiv/TISa9TbIR9iTQoJHN21uLV4IVSBGyW5KBEF YUKQ== 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=M/J8cyPJt4Ll9RZS948MXK6mAeXy+ZI4TTtagozWqOU=; b=EUFY6iiMjvsLDNw6rRw0aeCJAMM+MomUfxmpQT1OZ5fqTtNs6TnwMcfeIBe1WiaBWA +MjomX2GmBD/ipVv9fNykromvT/ezfDwqitNlrb7S2kmyKoY/4jIDsq/ZZYW7N4eYp0t X0XLseYPzl2GgKQsfNIslUkLC0vqtQKWgLGYVpGkLh97rx6SLChGEfBwb4BMo4R1dnL3 2dIp1QQWxb0MUnW3BE47cYCSo4IaH313GfDx2QkUULiAKW6xptICWQsudYDHL202UWL6 t4Xry94cKO2OnfAwT1Dbz6/wLbB31kkdJnExgMvx8Va7MQ3j8sI3RJNERQLGq8BXslxn Ssjg== X-Gm-Message-State: ANoB5pkDtd87964CVONVqYnOmCyxJpgL8Zu+QiQKYG9zoX/vmmK9LVNh 1PqEq4HLN7CSzRatbYKCdIEDp5RnUzXsJim/lKOAgiGo X-Google-Smtp-Source: AA0mqf67dSU/xL1/uCeTX9QDQMFMb/LC6a/ygq+kcyTHdJXsPr+GBls0ZSkrIwMuLHCHzKN952XJxG245LDwtndm4vk= X-Received: by 2002:a63:dd43:0:b0:45c:5a74:9a92 with SMTP id g3-20020a63dd43000000b0045c5a749a92mr43697471pgj.473.1669940269922; Thu, 01 Dec 2022 16:17:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: leon zadorin Date: Fri, 2 Dec 2022 11:17:38 +1100 Message-ID: Subject: Re: which compiler is right (either to compile or to barf)... To: gcc-help Content-Type: multipart/alternative; boundary="00000000000095c08405eecd441f" X-Spam-Status: No, score=-0.2 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: --00000000000095c08405eecd441f Content-Type: text/plain; charset="UTF-8" On Fri, Dec 2, 2022 at 10:54 AM Jonathan Wakely wrote: > On Thu, 1 Dec 2022 at 23:27, leon zadorin via Gcc-help > wrote: > > The current thought prorcess is that std component must be allowed by the > > standard to be instantiated with incomplete type T. And vector is allowed > > so indeed (but I think it must be complete by the time its members, e.g. > > via member-function invocation, are referenced)... so then it may come > down > > to std::optional and its implementation -- whether its ctor is > referencing > > any vector's members (dtor etc.) ... > > > > I suppose the official way would be to find whether ::std::optional may > be > > instantiated with incomplete type T > > It may not be. > > > (say even if only when using default, > > no value present, ctor overload)... and if it not mentioned of being able > > to do so then it would be a bug in the original code (at which point > having > > some toolchain being able to detect it is rather super nice :) :) > > > > I dont know to be honest if standard's doco for such ctor , e.g. > > constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; > > Postconditions: *this does not contain a value. > > > > Remarks: No contained value is initialized. > > > > For every object type T these constructors are constexpr > > constructors > > > > would be sufficient to infer the ability to instantiate with incomplete > > type... probably not (I'm not enough of an expert to see through this > with > > my cloudy head atm :) > > Those constructors are irrelevant. It's undefined to instantiate *any* > std::lib template with an incomplete type unless *explicitly* > permitted. It is explicitly permitted for vector and shared_ptr. It is > not permitted for optional. > Thanks Jonathan for clarifying, as always - very precise and helpful. I'll close the issue on the clang side also. --00000000000095c08405eecd441f--