Invalid operands to binary expression on TGridOptions

  

I have recently upgraded from C++ Builder XE8 to Rad Studio 10 Seattle. I am trying to use the new Clang compiler but I am running into an issue.

On a custom grid class I have the following line of code:

__property Options = {default=TGridOption::AlternatingRowBackground << TGridOption::RowSelect};

Which causes the following error from the compiler:

[CLANG Error] FmGridU.h(57): invalid operands to binary expression (‘Fmx::Grid::TGridOption’ and ‘Fmx::Grid::TGridOption’)

From what I have read in other questions, I need to do something like implement my own << operator. However, I am not exactly sure how I would go about doing this. From my understanding, the current code is the standard way to work with control options.

What is the difference with the new Clang compiler that causes it to thrown an error where the Classic Boreland compiler does not? How can I implement the << operator to allow me to set the options property?

Edit:

I have corrected my syntax as per Remy’s suggestion.

__property Options = {default = TGridOptions() << TGridOption::AlternatingRowBackground << TGridOption::RowSelect};

However, now I get the following error:
‘expression is not an integral constant expression’

According to this question the answer was to put the code inside of a function. However, since I am declaring this property in a header file, I am not sure how to do that. Is there something else I am missing?

Comments are closed.