[llvm-bugs] [Bug 36745] New: Debug info for variadic templates

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 14 13:31:07 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36745

            Bug ID: 36745
           Summary: Debug info for variadic templates
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kiranchandramohan at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

template<typename T>
T accumulator(T v) {
  return v;
}

template<typename T, typename... Args>
T accumulator(T first, Args... args) {
  return first + accumulator(args...);
}

int main()
{
long sum = accumulator(1, 3, 5, 7);
return sum;
}

The testcase is given above. This testcase is an example for variadic
templates. The debug info generated for this testcase by clang seems to be
incorrect. The accumulator is passed the values (1,3,5,7). All the non-first
elements are shown with value 7 at the breakpoint. Ideally they should be
first=1, args=3, args=5, args=7

Breakpoint 2, accumulator<int, int, int, int> (first=1, args=7, args=7, args=7)
at simple_var.cpp:8
8         return first + accumulator(args...);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180314/b86210b7/attachment-0001.html>


More information about the llvm-bugs mailing list