[LLVMbugs] [Bug 20009] New: std::vector::insert(position, n, x) does not respect exceptions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 12 00:02:48 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20009

            Bug ID: 20009
           Summary: std::vector::insert(position, n, x) does not respect
                    exceptions
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 12645
  --> http://llvm.org/bugs/attachment.cgi?id=12645&action=edit
insert_n.cc

% g++ ./insert_n.cc && ./a.out 
THROW
% clang++ ./insert_n.cc && ./a.out 
THROW
% clang++  -I$LIBCXX_ROOT/include  $LIBCXX_ROOT/lib/libc++.so 
-Wl,-R$LIBCXX_ROOT/lib ./insert_n.cc  && ./a.out 
a.out: ./insert_n.cc:35: int main(): Assertion `0' failed.
Aborted (core dumped)
% 

The code: 

  try {
    v.insert(v.begin(), 2, X(66));  <<<<< The CTOR should throw
    assert(0);

Looks like this variant of insert does not call copy ctors and hence they don't
throw. Sounds like a bug to me.

-- 
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/20140612/cc103168/attachment.html>


More information about the llvm-bugs mailing list