New gcc 4.7 c++ error

Krzesimir Nowak qdlacz at gmail.com
Mon Jan 30 21:34:19 UTC 2012


2012/1/30 Orion Poplawski <orion at cora.nwra.com>:
> On 01/30/2012 11:49 AM, Kalev Lember wrote:
>>
>> On 01/30/2012 08:24 PM, Orion Poplawski wrote:
>>>
>>> I am getting the following error building paraview with gcc 4.7:
>>>
>>> In file included from
>>> /builddir/build/BUILD/ParaView-3.12.0/Qt/Core/pqAnimationScene.cxx:57:0:
>>>
>>> /builddir/build/BUILD/ParaView-3.12.0/Qt/Core/pqServerManagerSelectionModel.h:75:30:
>>> error: calls to overloaded operators cannot appear in a
>>> constant-expression
>>>
>>> code snippet:
>>>
>>> class PQCORE_EXPORT pqServerManagerSelectionModel : public QObject
>>> {
>>>   Q_OBJECT
>>> public:
>>>   /// Supported selections flags. These are a subset of
>>>   /// QItemSelectionModel::SelectionFlags.
>>>   enum SelectionFlag {
>>>     NoUpdate       = QItemSelectionModel::NoUpdate,
>>>     Clear          = QItemSelectionModel::Clear,
>>>     Select         = QItemSelectionModel::Select,
>>>     Deselect       = QItemSelectionModel::Deselect,
>>>     ClearAndSelect = Clear | Select
>>
>>
>> Looks like gcc cannot resolve Clear and Select to a
>> constant-expression and you'll need to spell out the
>> scope. Try changing the line above to:
>>     ClearAndSelect = QItemSelectionModel::Clear |
>> QItemSelectionModel::Select
>>
>>
>
> I did try that, but no go.  I think the | operator is overloaded somewhere.
>

I guess that Q_DECLARE_FLAGS macro for QItemSelectionModel overrides
this operator.

Possible workaround for it would be:

ClearAndSelect = static_cast<int>(Clear) | static_cast<int>(Select)

>
> --
> Orion Poplawski
> Technical Manager                     303-415-9701 x222
> NWRA, Boulder Office                  FAX: 303-415-9702
> 3380 Mitchell Lane                  orion at cora.nwra.com
> Boulder, CO 80301              http://www.cora.nwra.com
> --
> devel mailing list
> devel at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel


More information about the devel mailing list