We have just noticed that our code doesn't compile with gcc, but didn't have any issue with clang. We normally write getters without a get
prefix because it often looks nicer, such as Context().Route().Leg(1).Arcs()
.
It can be made to work in gcc by specifying -fpermissive
, but what does that mean for standard-conformance?
class Contained {};
class Aggregate {
Contained contained_;
public:
class Contained Contained() { return contained_; }
// ^~~~~~~~~ gcc: error, declaration changes meaning; clang: ok
};