Skip to content

[[ deprecated ]] does not compile with using statements

[[deprecated]] is incompatible with using statements (at least for me with gcc62 and gcc7). Building this header alone (i.e. a one-line cpp file that does only the include) results in an error instead of the desired warning:

In file included from GaudiKernel/GaudiKernel/GaudiKernel/DataObjIDProperty.h.cpp:1:0:
../GaudiKernel/GaudiKernel/DataObjIDProperty.h:7:77: error: expected unqualified-id before 'using'
 [[deprecated( "replace DataObjIDProperty by Gaudi::Property<DataObjID>" )]] using DataObjIDProperty =
                                                                             ^~~~~
../GaudiKernel/GaudiKernel/DataObjIDProperty.h:9:85: error: expected unqualified-id before 'using'
 [[deprecated( "replace DataObjIDCollProperty by Gaudi::Property<DataObjIDColl>" )]] using DataObjIDCollProperty =
                                                                                     ^~~~~

With a typedef and an instantiation, one receives the desired warning

GaudiKernel/GaudiKernel/GaudiKernel/DataObjIDProperty.h.cpp:3:23: warning: 'DataObjIDCollProperty' is deprecated: replace DataObjIDCollProperty by Gaudi::Property<DataObjIDColl> [-Wdeprecated-declarations]
 DataObjIDCollProperty a;
                       ^
In file included from GaudiKernel/GaudiKernel/GaudiKernel/DataObjIDProperty.h.cpp:1:0:
../GaudiKernel/GaudiKernel/DataObjIDProperty.h:8:124: note: declared here
 [[deprecated( "replace DataObjIDCollProperty by Gaudi::Property<DataObjIDColl>" )]] typedef Gaudi::Property<DataObjIDColl> DataObjIDCollProperty;
                                                                                                                            ^~~~~~~~~~~~~~~~~~~~~
Edited by Paul Seyfert

Merge request reports

Loading