[ create a new paste ] login | about

Link: http://codepad.org/rq30wdeq    [ raw code | output | fork ]

litb - C++, pasted on Oct 27:
1
2
3
4
5
6
7
#include <boost/mpl/assert.hpp>

template<typename T> struct not_defined : boost::mpl::false_ { }; 
template<typename T> T GetGlobal(char const *name) 
{ BOOST_MPL_ASSERT(( not_defined<T> )); }

int main() { GetGlobal<int>("hello"); }


Output:
1
2
3
4
In function 'T GetGlobal(const char*) [with T = int]':
t.cpp:8:   instantiated from here
Line 5: error: no matching function for call to 'assertion_failed(mpl_::failed************ not_defined<int>::************)'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: