C++11 specifies destructors as noexcept by default. Is there a way I can get Clang to report cases where my noexcept destructors might throw an exception (and hence call std::terminate)?
Can Clang warn me when I might throw an exception from a `noexcept` destructor?
802 Views Asked by fbrereto At
1
There are 1 best solutions below
Related Questions in C++11
- C++ using std::vector across boundaries
- Using QPointer and QObject::connect with C++11
- Using std::vector<> and std::shared_ptr<> should cause error
- invoking function for each variadic template arguments and passing the result as constructor arguments
- Different behavior of async with Visual Studio 2013(Windows8.1) and GCC 4.9(Ubuntu14.10)
- Whether to use T const& or T&&
- C++ IRC Bot Buffer Error
- Downcast from a container of Base* to Derived* without explicit conversion
- Assigning values in a vector in non-sequential order
- Can I use C++11 list-initializer syntax for vectors with variables?
- is it fine to use auto keyword in function parameter?
- Variadic template method and std::function - compilation error
- Clustering on Graph (using Boost Graph Library)
- libc++ difference between vector::insert overloads
- Cannot convert argument1 to const char
Related Questions in EXCEPTION
- Python twisted not catching exception
- Proper use of custom exceptions
- C++ Mongodb driver, not working
- C# console application - Unhandled exception while finding the Available and free Ram space.Getting exact answer in windows forms application
- Hashing String (SHA-256) in an ActionListener class
- Do we have to mention exception type in java?
- How can I make Eclipse (or javac) warn about over-inclusive throws clauses
- Why can an Exception not be rethrown in the BackgroundWorker RunWorkerCompleted event
- How can I set the the expected Exception type for a catch statement with a parameter I've passed into a method?
- Why do I get an IndexOutOfBoundsException when my else should prevent it?
- crypto.BadPaddingException: data hash wrong (EKYC-Response)
- How to print the first line from a traceback stack
- java.lang.ArrayIndexOutOfBoundsException object array
- Passing keyword arguments to custom exceptions - anomaly
- Unauthorised access to folders when creating xml file
Related Questions in CLANG
- Cross compile simple standard C program on Linux for Mac
- Automatically wrap C/C++ function at compile-time with annotation
- clang -Xclang -cc1 -O3 mips.c -emit-llvm , clang error: -emit-llvm cannot be used when linking
- clang::HeaderSearch search path ignored
- Apple Mach-O Linker Error - ld: file not found: -ObjC
- different clang and gcc behavior with pointers
- How to use Clang compiler with MSBuild?
- MacPorts clang not using its own headers
- How to set compiler-specific flags with autotools
- Do I need to install all header files and libraries myself when using clang?
- In LLVM IR, how can I print the name of a unnamed value which is represented as an unsigned numeric value with their prefix such as %2?
- Why static_assert calls in unused template methods in LLVM
- Why clang doesn't issued a warning with using uninitialized array?
- How to traverse all nodes of clang AST?
- When can/will a function be inlined in C++? Can inline behavior be forced?
Related Questions in CLANG++
- os kern error : "ld: symbol(s) not found for architecture x86_64"
- clang 3.4 C++14 support
- Using std::stoi and std::stod with clang++ in Windows
- Clang (3.6.0) ignores warnings from included header files
- Does g++ linker optimizes unused libraries out when creating shared libraries?
- Linking a shared library in executable vs. another shared lib
- Cannot compile code with clang, but works with gcc
- Confusing clang error attempting to instantiate std::thread with a pointer
- Variable getting destroyed before calling lambda
- __uint128_t not working with Clang and libstdc++
- Lambda return of value without capture
- How to create and open a file system through the Chrome Pepper C API?
- OS X equivalent of --unresolved-symbols=ignore-in-object-files
- Why initial auto-vectorication loads from aligned std::array are scalar? (g++/clang++)
- Parameter with non-deduced type after parameter pack
Related Questions in NOEXCEPT
- How to find out whether an assignment operator of T in a function template throws an exception?
- Why does std::is_nothrow_move_assignable depend on the presence of a destructor?
- std::function with noexcept in C++17
- Should I use noexcept for simple functions that obviously cannot throw?
- Can Clang warn me when I might throw an exception from a `noexcept` destructor?
- noexcept depending on method of member
- Why vector access operators are not specified as noexcept?
- Can I force a default special member function to be noexcept?
- Why does std::function cause the stack to be unwound only when an exception escapes the current function?
- Use of the noexcept specifier in function declaration and definition?
- C++ throw() (_NOEXCEPT) after function declaration
- What is noexcept useful for?
- How do I create a noexcept function pointer?
- How do I create an alias for a noexcept function pointer?
- When should I really use noexcept?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
First, C++ does not specify destructors as
noexceptby default.It specifies them as
noexcept(all subobjects destructors are noexcept).Next, we can categorize expressions and statements in one category each of:
In all of them, only the first case will be marked as exceptional.
In order to give good results, the compiler must be able to analyze the program behavior sufficiently to determine whether for any possible state, a throwing expression is ever executed.
If you are happy with far too many warnings about impossible scenarios, you can get a result here.
Conversely, if you only want to warn about blatant cases, you might also get some results.
Trouble is, all the interesting cases devolve to solving the halting problem.
And no, we are no further along with it.