【发布时间】:2015-09-02 13:51:28
【问题描述】:
我最近从 C++ Builder XE8 升级到 Rad Studio 10 Seattle。我正在尝试使用新的 Clang 编译器,但遇到了问题。
在自定义网格类中,我有以下代码行:
__property Options = {default=TGridOption::AlternatingRowBackground << TGridOption::RowSelect};
这会导致编译器出现以下错误:
[CLANG Error] FmGridU.h(57): invalid operands to binary expression ('Fmx::Grid::TGridOption' and 'Fmx::Grid::TGridOption')
根据我在其他问题中读到的内容,我需要做一些事情,比如实现我自己的 << 运算符。但是,我不确定我将如何去做。据我了解,当前代码是使用控制选项的标准方式。
新的 Clang 编译器有什么不同导致它抛出经典 Boreland 编译器没有的错误?如何实现 << 运算符以允许我设置 options 属性?
编辑:
我已按照 Remy 的建议更正了我的语法。
__property Options = {default = TGridOptions() << TGridOption::AlternatingRowBackground << TGridOption::RowSelect};
但是,现在我收到以下错误:
'expression is not an integral constant expression'
根据this question,答案是将代码放在函数中。但是,由于我在头文件中声明了这个属性,所以我不知道该怎么做。我还有什么遗漏的吗?
【问题讨论】:
-
other question 与 C++Builder 编译器或属性无关。
-
@RemyLebeau 对。由于错误是相同的,我认为它至少可以引导我朝着正确的方向前进。
标签: c++ clang c++builder firemonkey c++builder-10-seattle