The following is valid in gcc 4.8:
class Value {
private:
static std::vector<float> compile_time_vector;
const bool compile_time_bool;
static bool f(void) {
compile_time_vector.push_back(2.3);
return true;
}
public:
template <typename type_t>
constexpr Value(const type_t& value): compile_time_bool(f()) {}
};
std::vector isn't designed to work at compile time, so exactly what kind of code is this generating? I've used the class to make sure it isn't optimized out.