[cfe-dev] libc++ does not throw an exception where libstdc++ does

Shriramana Sharma samjnaa at gmail.com
Sat Jun 29 11:31:51 PDT 2013


Hello. I'm using Kubuntu Raring 64 bit with libstdc++ 4.8.1 (from the
ubuntu-toolchain-r PPA) and Clang 3.2 (default Raring package). I have
now built and installed libc++ from latest SVN revision 185264 against
libsupc++ as per the instructions at libcxx.llvm.org.

I find that the attached simple code prints the "out_of_range was
thrown" message from within the catch block when compiled with
libstdc++ but when compiled with libc++ it is not printed. Curiously,
if the cout<< line (which I have commented out) in the try block is
executed, then the exception is thrown and the message printed.
Commenting out the cout<< line again makes the exception go away.

I encountered this problem yesterday with some other code in my
project but I wasn't able to provide a minimal example but this code
is pretty minimal so I hope the problem can be identified easily and
fixed.

Thank you for Clang and libc++ -- it has already caught two instances
of non-standards-compliance in my code which libstdc++ didn't.

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cvector.cpp
Type: text/x-c++src
Size: 1960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130630/3b37b232/attachment.cpp>


More information about the cfe-dev mailing list