From patchwork Wed Mar 29 02:32:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 55633 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC28738515D7 for ; Wed, 29 Mar 2023 02:33:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC28738515D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680057236; bh=YEc8AituqNvizwnf+tU8odlnMmuD2Yk+b2omdngp82M=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ZtDHESIXUG0XJP4HSitd7gsWFAdJqhKnBsjjoqP7ItvX9eSyqR4HHnVCEWDXaVBm2 EEtXO4Qu0QxUaK3oizrVH+VV2qmWqOat2yTHLyMhPAjj/3HQ9k0Cx+92rKfmEeJ6OF 04GXl8C7sEJSqBFl3rSH9kn+2m9YecbnnI3muRi8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id AB80E3858D39 for ; Wed, 29 Mar 2023 02:33:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB80E3858D39 Received: by mail-pg1-x533.google.com with SMTP id s19so8452829pgi.0 for ; Tue, 28 Mar 2023 19:33:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680057196; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YEc8AituqNvizwnf+tU8odlnMmuD2Yk+b2omdngp82M=; b=lPc2ZPYGwH6CJukfNRSSS8fchXjkL2FN8sbFHIu/jvlAgyJdF2DTT9P3SOJ5KTqJvV 7i0r2IzjNebxU+dvdIjSC100AMIinFRJS5aWLd09+apJZ6ieN45S6rW7VH7DXELu/ivK LY5uPS/82vLlG+ubth91O9hEnGVPxH860H1sdncYFmCD/ljhF7zXVlcJQCVAt8GjrYUf aouw8C8YhvFy9w7jUD3j+KUvc/Bgqvbj3mmE82616Muy7lTx9ynvUs3rts3rziTKTVjv J9P87jUFA178FgRThhcOedgQ5gpw4oFRdnOHi1bU8PWCtdwydy6bOZHWzMTJ/FbpBVeL PoFg== X-Gm-Message-State: AAQBX9eLLlyy7UcEgtjlOdBIr2BWHTTIhTjc8qt5qV10jFmmwsjFDUJJ 1MWXI4ZcdfQuClgSe8qF3nEQ/jc0n8o= X-Google-Smtp-Source: AKy350aqLnTGWHLypVy5dpYjP4CTKmTLdSLwLbBKhmC4qFU8arWacgpeKKetQVOVT9miqFCXT/RhKA== X-Received: by 2002:a62:1c83:0:b0:625:cf03:e8cb with SMTP id c125-20020a621c83000000b00625cf03e8cbmr807189pfc.4.1680057196138; Tue, 28 Mar 2023 19:33:16 -0700 (PDT) Received: from Thaum.localdomain (125-209-144-50.tpgi.com.au. [125.209.144.50]) by smtp.gmail.com with ESMTPSA id r1-20020a62e401000000b005a8ba70315bsm21811004pfh.6.2023.03.28.19.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 19:33:15 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Nathaniel Shead Subject: [PATCH v2 0/3] c++: Track lifetimes in constant evaluation [PR70331, ...] Date: Wed, 29 Mar 2023 13:32:55 +1100 Message-Id: <20230329023258.13487-1-nathanieloshead@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nathaniel Shead via Gcc-patches From: Nathaniel Shead Reply-To: Nathaniel Shead Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This is an update of the patch series at https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614759.html The main change is modifying the first patch to store the "expired" flag in the C++-specific lang_decl_base struct instead of tree_decl_common. The second and third patches to improve diagnostic locations are otherwise unchanged. Bootstrapped and regression tested on x86_64 linux. Nathaniel --- Nathaniel Shead (3): c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675] c++: Improve constexpr error for dangling local variables c++: Improve location information in constexpr evaluation gcc/cp/constexpr.cc | 152 ++++++++++++------ gcc/cp/cp-tree.h | 10 +- gcc/cp/module.cc | 2 + gcc/cp/semantics.cc | 5 +- gcc/cp/typeck.cc | 5 +- gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | 10 +- gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C | 2 +- gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C | 2 +- gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C | 3 +- .../g++.dg/cpp1y/constexpr-lifetime1.C | 14 ++ .../g++.dg/cpp1y/constexpr-lifetime2.C | 20 +++ .../g++.dg/cpp1y/constexpr-lifetime3.C | 13 ++ .../g++.dg/cpp1y/constexpr-lifetime4.C | 11 ++ .../g++.dg/cpp1y/constexpr-lifetime5.C | 11 ++ gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C | 4 +- gcc/testsuite/g++.dg/cpp1y/pr68180.C | 4 +- .../g++.dg/cpp1z/constexpr-lambda6.C | 4 +- gcc/testsuite/g++.dg/cpp2a/bit-cast11.C | 10 +- gcc/testsuite/g++.dg/cpp2a/bit-cast12.C | 10 +- gcc/testsuite/g++.dg/cpp2a/bit-cast14.C | 14 +- gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C | 4 +- .../g++.dg/cpp2a/constexpr-dynamic17.C | 5 +- gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C | 5 +- gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C | 6 +- gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C | 10 +- gcc/testsuite/g++.dg/ext/constexpr-vla2.C | 4 +- gcc/testsuite/g++.dg/ext/constexpr-vla3.C | 4 +- gcc/testsuite/g++.dg/ubsan/pr63956.C | 4 +- .../g++.dg/warn/Wreturn-local-addr-6.C | 3 - .../25_algorithms/equal/constexpr_neg.cc | 7 +- 30 files changed, 246 insertions(+), 112 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C