• 1359阅读
  • 1回复

qt5.11  constexpr问题 [复制链接]

上一主题 下一主题
离线hfutzhu
 

只看楼主 倒序阅读 楼主  发表于: 2020-05-17
我的编译环境是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; }
这个是什么意思?
离线青空飞羽

只看该作者 1楼 发表于: 2020-05-18
.如果m_flag在编译时能确定,那么返回值就可以是constexpr,编译通过,否正编译失败
快速回复
限100 字节
 
上一个 下一个