Bar*_*air 8 c++ type-traits language-lawyer c++17
对于下面的程序,Clang 5(主干)报告IsNoexcept不可扣除,而GCC 7.1段错误.标准(草案)对此有何评论?这是编译器QOI问题吗?
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() {}
Run Code Online (Sandbox Code Playgroud)
与提案P0012有关.
noexcept简化的实施std::is_function。似乎该扩展程序仅经过了非常轻松的测试。这不是一致的扩展,因为它更改了定义良好的代码的含义,例如,g(f)带有以下代码段的值:
void f() noexcept;
template<bool E = false, class R>
constexpr bool g(R (*)() noexcept(E)){
return E;
}
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
356 次 |
| 最近记录: |