static_assert fails compilation even though template function is called nowhere
I use g++ 4.6.3, (currently default package for ubuntu 12.04) with the flag c++0x, and I stumble across this: template <typename T> inline T getValue(AnObject&) { static_assert(false , "this function has to be implemented for desired type"); } with the compilation error: static_assertion failed "this function has to be implemented for the desired type" even though I don't call this function anywhere yet . Is it a g++ bug ? Shouldn't this function be instanciated only if it is called somewhere in the code. That's because the condition does not depend in any way on the template parameters.