MSVC 10 and MSVC 9 are both generating a level 4 warning message when compiling my exception framework, although the behavior of the program seems correct. The exception framework is rather large & complex, but I have managed to boil it down to its essence. This is a complete program you can compile & run in VS10.#include <iostream>#include <vector>#include <algorithm>#include <stdexcept>using namespace std;class MyException : virtual public std::exception{public: MyException(const std::string& error) : error_(error) {};private: std::string error_;};class My2ndException : virtual public std::exception{public: My2ndException(int n) : n_(n) {};private: int n_;};template<class EX> class TracedException : virtual protected std::exception, virtual public EX{public: TracedException(const std::string& file, int line, const EX& ex) : EX(ex), file_(file), line_(line) {};private: std::string file_; int line_;};template<class EX> TracedException<EX> make_traced_exception(const std::string& file, int line, const EX& ex){ return TracedException<EX>(file, line, ex);}#define throwx(EX) (throw make_traced_exception(__FILE__, __LINE__, EX))int main(){ try { throwx(MyException("Oh, Darn.")); } catch( const MyException& ex ) { ex; } catch( const My2ndException& ex2 ) { ex2; }};When compiling the line:throwx(MyException("Oh, Darn."));...the compiler emits:1> main.cpp1>main.cpp(43): warning C4673: throwing 'TracedException<EX>' the following types will not be considered at the catch site1> with1> [1> EX=MyException1> ]By my reading of the C++ Standard, my code is well-formed and correct. In addition, the code seems to function correctly when execute it. The error messages says there are incompatible types, but it fails to list those incompatible types even though it promises to list them.There is a knowledge base article about this (ahttp://msdn.microsoft.com/en-us/library/32y577d8.aspx) but the suggested resolution -- to not throw the exception -- is completely unacceptable.I also do not want to disable the warning via a pragma, as this code will be in an #include library.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results