This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Alan Lawrence <alan dot lawrence at arm dot com>, Doug Evans <dje at google dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 26 Nov 2015 16:26:05 +0000
- Subject: Re: [PATCH] libstdc++: Fix libstdc++/67440: pretty-printing of a const set<foo> fails
- Authentication-results: sourceware.org; auth=none
- References: <047d7b10cdcf8731080524aec2e9 at google dot com> <5655F014 dot 9080508 at arm dot com> <CAH6eHdS_a8sGkF3dEjH+jyMnVfht2wn7VPGZGf2YXmW=chb7Kw at mail dot gmail dot com> <20151126154259 dot GQ11200 at redhat dot com> <20151126161006 dot GS11200 at redhat dot com>
On 26/11/15 16:10 +0000, Jonathan Wakely wrote:
On 26/11/15 15:42 +0000, Jonathan Wakely wrote:
On 25/11/15 19:55 +0000, Jonathan Wakely wrote:
On 25 November 2015 at 17:29, Alan Lawrence <alan.lawrence@arm.com> wrote:
On 16/11/15 21:04, Doug Evans wrote:
Hi.
Apologies for the delay.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67440
Tested with current trunk.
2015-11-16 Doug Evans <dje@google.com>
PR libstdc++/67440
* python/libstdcxx/v6/printers.py (find_type): Handle "const" in
type name.
* testsuite/libstdc++-prettyprinters/debug.cc: Add test for
const set<int>.
* testsuite/libstdc++-prettyprinters/simple.cc: Ditto.
* testsuite/libstdc++-prettyprinters/simple11.cc: Ditto.
On gcc-5-branch, the debug.cc and simple.cc tests don't seem to compile, on
either x86_64-none-linux-gnu or aarch64-none-linux-gnu. I get errors like:
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:
In function 'int main()':
/work/alalaw01/src/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc:77:43:
error: in C++98 'const_intset' must be initialized by constructor, not by
'{...}'
const std::set<int> const_intset = {2, 3};
^
Which should have failed to compile on trunk as well, but we're
missing a -std=gnu++98 in the simple.cc testcase, so on trunk it uses
the -std=gnu++14 default. I'll add -std=gnu++98 to the test.
I've committed this to trunk, and will apply it to gcc-5-branch after
I finish testing it on the branch.
Doh, but I need to fix debug.cc as well, another patch coming ...
Same change for debug.cc, committing on trunk and gcc-5-branch.
commit 9cfee9f413f80091d03f2483697f95316a785354
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Nov 26 16:11:37 2015 +0000
Ensure another pretty-printer test uses C++98 mode
* testsuite/libstdc++-prettyprinters/debug.cc: Add -std=gnu++98 to
dg-options and avoid use of uniform-init.
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
index 8d40f17..046888f 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc
@@ -1,5 +1,5 @@
// { dg-do run }
-// { dg-options "-g -O0" }
+// { dg-options "-g -O0 -std=gnu++98" }
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
@@ -71,7 +71,10 @@ main()
// { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
// PR 67440
- const std::set<int> const_intset = {2, 3};
+ std::set<int> intset;
+ intset.insert(2);
+ intset.insert(3);
+ const std::set<int> const_intset = intset;
// { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } }
std::set<std::string> sp;