https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83906

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ah, or maybe the typedef std::__cxx11::string is not in the debug info, so the
type printer doesn't know that std::__cxx11::basic_string<char> is the same
type as std::__cxx11::string.

In testsuite/libstdc++-prettyprinters/whatis.cc we have a relevant comment:

// This test is written in a somewhat funny way.
// Each type under test is used twice: first, to form a pointer type,
// and second, as a template parameter.  This is done to work around
// apparent GCC oddities.  The pointer type is needed to ensure that
// the typedef in question ends up in the debuginfo; while the
// template type is used to ensure that a typedef-less variant is
// presented to gdb.


Does this patch help?

--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc
@@ -36,6 +36,7 @@ placeholder(const T *s)
 int
 main()
 {
+  std::string *string_ptr;
   using namespace std;
   unique_ptr<vector<unique_ptr<vector<int>*>>> p1;
   unique_ptr<vector<unique_ptr<set<int>*>>[]> p2;
@@ -50,6 +51,7 @@ main()
   placeholder(&p2);
   placeholder(&p3);
   placeholder(&p4);
+  placeholder(&string_ptr);

   std::cout << "\n";
   return 0;

Reply via email to