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>();
}

Reply via email to