查看完整版本: [-- qt5.11  constexpr问题 --]

QTCN开发网 -> Qt基础编程 -> qt5.11  constexpr问题 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

hfutzhu 2020-05-17 14:15

qt5.11  constexpr问题

我的编译环境是qt5.11  minw32位
有一个函数 constexpr bool active() const noexcept { return m_flag; }
编译报error: enclosing class of constexpr non-static member function 'bool Form::active() const' is not a literal type
     constexpr bool active() const noexcept { return m_flag; }
这个是什么意思?

青空飞羽 2020-05-18 17:38
.如果m_flag在编译时能确定,那么返回值就可以是constexpr,编译通过,否正编译失败


查看完整版本: [-- qt5.11  constexpr问题 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled