For the program below, Clang 5 (trunk) reports that IsNoexcept
is not deducible, while GCC 7.1 segfaults. What does the standard (draft) say about this? Is this a compiler QOI issue?
static_assert(__cpp_noexcept_function_type, "requires c++1z");
template<typename T>
struct is_noexcept;
template<bool IsNoexcept>
struct is_noexcept<void() noexcept(IsNoexcept)> {
static constexpr auto value = IsNoexcept;
};
static_assert(is_noexcept<void() noexcept>::value);
static_assert(!is_noexcept<void()>::value);
int main() {}
Relates to proposal P0012.
noexcept
to ease the implementation of std::is_function
. It looks like the extension is only very lightly tested.This is not a conforming extension because it changes the meaning of well-defined code, e.g., the value of g(f)
with the following snippet:
void f() noexcept;
template<bool E = false, class R>
constexpr bool g(R (*)() noexcept(E)){
return E;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With