Tavian Barnes - 2015-07-08

Sorry, didn't realise SourceForge uses markdown.

$ cat foo.cpp
#include <stdexcept>
#include <utility>

template <typename E = std::logic_error, typename Cond, typename... Args>
void check(Cond&& condition, Args&&... args) {
  if (!static_cast<bool>(condition)) {
    throw E(std::forward<Args>(args)...);
  }
}

void foo(int i) {
  check(i >= 0, "i is negative");
}
$ x86_64-w64-mingw32-g++ -O3 -flto -std=c++11 foo.cpp -shared -o foo.dll
Cannot export _Z5checkISt11logic_errorbIRA14_KcEEvOT0_DpOT1_: symbol wrong type (4 vs 3)
collect2: error: ld returned 1 exit status