MuseScore violates the C++ One Definition Rule [-Wodr]

• Jun 13, 2021 - 16:19
Reported version
3.6
Type
Development
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project

G++ now complains about the following:

I mscore/importmxmlpass1.h                                              R34  <142  C1  1240|4D8 u|0073 17:19

struct PageFormat {
QSizeF size;
qreal printableWidth; // _width - left margin - right margin
qreal evenLeftMargin; // values in inch
qreal oddLeftMargin;
qreal evenTopMargin;
qreal evenBottomMargin;
qreal oddTopMargin;
qreal oddBottomMargin;
bool twosided;
};

typedef QMap PartMap;
typedef std::map MusicXmlPartGroupMap;

I libmscore/read206.h                                                   R24  <91   C1  699 |2BB u|0063 17:19

class PageFormat {
QSizeF _size;
qreal _printableWidth; // _width - left margin - right margin
qreal _evenLeftMargin; // values in inch
qreal _oddLeftMargin;
qreal _evenTopMargin;
qreal _evenBottomMargin;
qreal _oddTopMargin;
qreal _oddBottomMargin;
bool _twosided;

public:
PageFormat() {}

  const QSizeF& size() const          { return _size;          }    // size in inch

This is because PageFormat now has two definitions which are incompatible with each other.


Comments

I accidentally copied from the editor I had the 3.2 files open. One of the files got moved to a different path, but it’s still there.

I haven’t looked at master regarding this. You’ll need a recent enough compiler (GCC in *buntu 21.04 seems to complain about this) to even see the messages.