[Bug c++/88628] lambda expression in static_assert in if constexpr is not evaluated
merukun1125 at docomo dot ne.jp
gcc-bugzilla@gcc.gnu.org
Fri Dec 28 17:02:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88628
--- Comment #9 from merukun1125 at docomo dot ne.jp ---
Tn Comment 6, not
#include <type_traits>
struct S { // A type that does not depend on template parameter T
auto operator()() const -> decltype(false) {
return false;
}
};
template<typename T>
T get() {
if constexpr (std::is_same_v<int, T>) return 0;
else static_assert(S{}(), "Lambda expression is evaluated.");
}
int main() {
get<int>();
}
It is right here:
#include <type_traits>
struct S {
constexpr S() = default;
constexpr auto operator()() const -> decltype(false) {
return false;
}
};
template<typename T>
T get() {
if constexpr (std::is_same_v<int, T>) return 0;
else static_assert(S{}(), "Lambda expression is evaluated.");
}
int main() {
get<int>();
}
More information about the Gcc-bugs
mailing list