Error in rstan_2.16.2 after upgrading to R 3.4.1 with Clang 4.0.0

Or even just call Rcpp::sourceCpp() on a C++ file like this

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
int throw_exception() {
  std::stringstream errmsg;
  errmsg << "this is an exception";
  throw std::domain_error(errmsg.str());
  return 0;
}