From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id E27653858C60 for ; Thu, 9 Feb 2023 13:26:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E27653858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org Received: by mail-wm1-x336.google.com with SMTP id j32-20020a05600c1c2000b003dc4fd6e61dso3854215wms.5 for ; Thu, 09 Feb 2023 05:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sFn8jj+HikJO43NFaDBY7OkwpPKaQmp6O0VvgTx5qLE=; b=Thopzhz1i6OejiArKevNKoPSKrFGXPON7huJvAHO86on1yE7FizsmEM4FSQ8KvdY9Q 1Xttp1YJIS+yvZO5E0KWWqrzZyzG4u4qEiTwk05FSwkdl9wz2R3lCM5eU5uZNouCPS3b PismkBXJVNbhinLydFjfdMR38vv72uqOv/+MokdLCDEu/UbDg9yXWUP1OBgvljZvPpXv ubOKt5EhK4pO8DrNYphOhAE/OgBqKmVUukYtybCaYWm3OPKHrtoG1oXOrogQ+9AOp1yE ZSbRFLQ0dNuZRZddaffHJcmrzUzcxNAF4YLqjfZuBgKIHpf6Fs/b6sEIyTwDMKD5FVxP RiyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sFn8jj+HikJO43NFaDBY7OkwpPKaQmp6O0VvgTx5qLE=; b=abTHP0qHV0q7KujNs4RvGgdqwmWuoP8hTtM18yUpUUKxukRDoPUitMY6v4iBPktav/ QN0640+ckDOz1YNCd7GVc8MB865zWL4+zYfXh470kcnTXbd5TFbiNPPCGdS303tiFa5x eTR5Ezgm5NNQ+NJwhN6DwuyfYE6TUNNuiDp602gBsRP+BxhAM2ggfvHjOt3H04bQKgKz tQcUZj+CpQCAqOe+/6hHDEJXFBkFTF5svmKf+CDSyUwCZSbee05igMPx3OkDRQ5tXMFV tFmOc09qpcXwWExYDriUX+EG9ONeM0PdGXWKR4C6TOB3fSENRyUBCs/OD1y7yerp3JgR td1w== X-Gm-Message-State: AO0yUKVLwIs17xy5KEuGN7Bh19V7qoGhlzJbujgTPRPmZ/pj1nhR3lTR 7MrtO6f2HBzt40538ehLEMtt6FELO1NOXSXh X-Google-Smtp-Source: AK7set/lI/1twUtni8hzpGGMMdgMvbg7+J+gvqLvAU7TyjRxivS5xrFVtDAKdICTAjxWCueqH9XfxQ== X-Received: by 2002:a05:600c:32a7:b0:3df:dea7:8ec with SMTP id t39-20020a05600c32a700b003dfdea708ecmr10276375wmp.20.1675949194527; Thu, 09 Feb 2023 05:26:34 -0800 (PST) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id t15-20020a05600c198f00b003ddc781b1d4sm2048054wmq.33.2023.02.09.05.26.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Feb 2023 05:26:34 -0800 (PST) Message-ID: <7e6e3bbf-0dac-0632-0e8f-372bd32a6923@jguk.org> Date: Thu, 9 Feb 2023 13:26:33 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-GB From: Jonny Grant Subject: std::string add nullptr attribute To: gcc-help Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: Hello Could GCC's STL implementation add nullptr attribute to prevent code like this compiling? g++ -Wall -o string string.cpp std::string c(nullptr); At least GCC STL does reject it at runtime: terminate called after throwing an instance of 'std::logic_error' what(): basic_string: construction from null is not valid Aborted (core dumped) Note, my code isn't like this, it is just an example to suggest adding the nullptr attribute, as its clearly already rejected at runtime. Regards Jonny