[llvm-bugs] [Bug 39231] New: Segfault with operator '^' overload for integer_sequences when specifying wrong parameter pack

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 9 10:50:26 PDT 2018


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

            Bug ID: 39231
           Summary: Segfault with operator '^' overload for
                    integer_sequences when specifying wrong parameter pack
           Product: clang
           Version: 7.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: niekbouman at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20980
  --> https://bugs.llvm.org/attachment.cgi?id=20980&action=edit
Preprocessed source, associated run script and crash backtrace

The following code crashes.
Note the programming error, the function argument b of the overloaded operator^
takes the wrong parameter pack: A... instead of B..., which results in a
segfault on clang 7 (also tested with clang 6 and apple clang 9, where bug is
also present).

----

#include <utility>

template <typename T, T... A, T... B>
void operator^(std::integer_sequence<T, A...> a,
               std::integer_sequence<T, A...> b) {
  // programming error, argument b takes A... pack instead of B...
}

int main() {

  using T = uint64_t;
  std::integer_sequence<T, 1, 2, 3>{} ^ std::integer_sequence<T, 4, 5, 6>{};
  return 0;
}

-- 
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/20181009/d1a27e24/attachment.html>


More information about the llvm-bugs mailing list