[PATCH] D26136: Protect exceptional path under libcpp-no-exceptions

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 02:47:15 PDT 2016


rmaprath added inline comments.


================
Comment at: test/std/strings/basic.string/string.access/at.pass.cpp:41
+    const S& cs = s;
+    if (pos < cs.size())
+    {
----------------
For the cases where an exception //should've been// thrown, are we not entering the **undefined** domain at this point?

What if instead, we define two versions of the `test()` function? one containing the current code as-is, and the other only handles the cases where exceptions are not expected, and we modify the `main()` function below so that the correct `test()` case is invoked depending on the presence  / absence of exceptions? It's a bit more cumbersome than the current setup, but I'm not totally happy about treading into the undefined domain (if my understanding above is correct). 


https://reviews.llvm.org/D26136





More information about the cfe-commits mailing list