From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id C200A3858283; Mon, 18 Mar 2024 14:03:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C200A3858283 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710770621; bh=NY8/0xnTs3pMz7A/EsbPPX74mQySP84rC1xvsShnjKI=; h=From:To:Subject:Date:From; b=SyHvpNwtBVspX7fbgAjSWeFs3J0LreUyq58NxmozbNCvGjIBaEFGP1tXl1yAsxpPX pB4SaEIiwx+pDzAW0zNgTaEgSJO6dEBnGF45SiAHedJbpRO5E32+PhB4QaG3mYVC2q wo7ocFfykBpkA1TuUVDnPyza1xg7SUDuSxxx+JKY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-10225] libstdc++: Move test error_category to global scope X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 7b9fa0982f4db0a64aacfe5018708a89f956245a X-Git-Newrev: a0bca5584725153ad560b97a33a07e3c56f6f953 Message-Id: <20240318140341.C200A3858283@sourceware.org> Date: Mon, 18 Mar 2024 14:03:41 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a0bca5584725153ad560b97a33a07e3c56f6f953 commit r12-10225-ga0bca5584725153ad560b97a33a07e3c56f6f953 Author: Jonathan Wakely Date: Wed Mar 13 10:02:12 2024 +0000 libstdc++: Move test error_category to global scope A recent GDB change causes this test to fail due to missing RTTI for the custom_cast type. This is presumably because the custom_cat type was defined as a local class, so has no linkage. Moving it to local scope seems to fix the test regressions, and probably makes the test more realistic as a local class with no linkage isn't practical to use as an error category that almost certainly needs to be referred to in other scopes. libstdc++-v3/ChangeLog: * testsuite/libstdc++-prettyprinters/cxx11.cc: Move custom_cat to namespace scope. (cherry picked from commit a8c7c3a40953e34f57278d224a07dc3698c64a84) Diff: --- libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc index f97640a0189..c79f0fab602 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc @@ -63,6 +63,11 @@ struct datum std::unique_ptr global; +struct custom_cat : std::error_category { + const char* name() const noexcept { return "miaow"; } + std::string message(int) const { return ""; } +}; + int main() { @@ -179,10 +184,7 @@ main() std::error_condition ecinval = std::make_error_condition(std::errc::invalid_argument); // { dg-final { note-test ecinval {std::error_condition = {"generic": EINVAL}} } } - struct custom_cat : std::error_category { - const char* name() const noexcept { return "miaow"; } - std::string message(int) const { return ""; } - } cat; + custom_cat cat; std::error_code emiaow(42, cat); // { dg-final { note-test emiaow {std::error_code = {custom_cat: 42}} } } std::error_condition ecmiaow(42, cat);