ldionne on gh-pages
Update benchmarks to 490dbf6 fo… (compare)
ldionne on gh-pages
Update benchmarks to 490dbf6 fo… (compare)
ldionne on gh-pages
Update benchmarks to 490dbf6 fo… (compare)
ldionne on gh-pages
Update benchmarks to 490dbf6 fo… (compare)
ldionne on gh-pages
Update benchmarks to 490dbf6 fo… (compare)
hana::template_<std::index_sequence>(hana::value(foo)...)
constexpr
variable), and that you didn’t get with Clang 3.8: I can indeed confirm that Clang trunk does not give an error. I think this is a bug, and it should error out. I don’t even know how it manages to compile it, and what code it generates… The compiler is very very smart if it can compile that.
#include <iostream>
struct Noisy
{
Noisy() { std::cout << "Noisy: constructed\n"; }
Noisy(const Noisy&) { std::cout << "Noisy: copy-constructed\n"; }
Noisy(Noisy&&) { std::cout << "Noisy: move-constructed\n"; }
~Noisy() { std::cout << "Noisy: destructed\n"; }
};
struct Silent { };
template<typename T>
constexpr int hello(T const) {
return 0;
}
int main() {
constexpr int x = hello(Silent{});
constexpr int y = hello(Noisy{});
}
y
y
cannot be evaluated at compile-time
#include <iostream>
struct Noisy {
Noisy() { std::cout << "Noisy: constructed\n"; }
Noisy(const Noisy&) { std::cout << "Noisy: copy-constructed\n"; }
Noisy(Noisy&&) { std::cout << "Noisy: move-constructed\n"; }
~Noisy() { std::cout << "Noisy: destructed\n"; }
};
struct Silent {
constexpr Silent() { }
};
template <typename T>
constexpr int f(T) { return 0; }
int main() {
Noisy t{}; // not constexpr
constexpr int result = f(t);
}
Silent
, it should error out. I’m going to try.
struct Foo {
Foo() : i{0} { }
constexpr Foo(Foo const& other) : i{other.i} { }
int i;
};
template <typename T>
constexpr int f(T) { return 0; }
int main() {
Foo t{};
constexpr int result = f(t);
}
Now, this fails with Clang trunk.