This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20540] New: Type printer template parameter substitution too greedy


https://sourceware.org/bugzilla/show_bug.cgi?id=20540

            Bug ID: 20540
           Summary: Type printer template parameter substitution too
                    greedy
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: keiths at redhat dot com
  Target Milestone: ---

Consider:

template <typename T>
struct A
{
  A (T val) : val_ (val), val2_ (-1) { }
  T get (void) const { return val_; }
  int add (int a) const { return val_ + a; }
  T val_;
  int val2_;
};

int
main (void)
{
  A<int> a (1);

  return a.add (a.get ());
}

Run gdb on resulting executable:

Reading symbols from /home/keiths/tmp/classt2...done.
(gdb) ptype A<int>
type = struct A<int> [with T = int] {
    T val_;
    T val2_;
  public:
    A(T);
    T get(void) const;
    T add(T) const;
}

Neither A::add nor A::val2_ was declared using template parameters, yet the
type printer substituted a template parameter because it saw "int".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]