On Aug 31, 5:17 pm, Michael Poole <mdpo...@troilus.org> wrote:
> Joshua Haberman writes:
> > The protobuf library compiled and installed fine, but the generated
> > classes threw warnings (and since I was compiling with -Werror, failed
> > to compile). The warning was:
> > benchmarks/google_messages.pb.cc: In copy constructor
> > ‘benchmarks::SpeedMessage2::SpeedMessage2(const
> > benchmarks::SpeedMessage2&)’:
> > benchmarks/google_messages.pb.cc:4179: warning: base class ‘class
> > google::protobuf::Message’ should be explicitly initialized in the
> > copy constructor
> > I thought this was an odd warning, since the constructors don't
> > explicitly initialize their base classes, and do not throw warnings.
> > I also thought it was odd since other versions of gcc don't throw this
> > warning AFAIK.
> This warning is triggered by using g++'s -Weffc++ warning flag. I
> raised this before, with a patch that was backed out because it led
> to constructor code being duplicated.
> Making both sides happy probably involves adding a command-line flag
> to protoc that toggles how it generates code: by default, omitting
> those constructor calls, but allowing the user to ask for those
> constructors to be called.
> Kenton, would that be a reasonable approach? If so, I should have
> time to update my patch to do that and resubmit.
Hmm, this does not seem to be the same warning. The warning you cite
is about a failure to initialize member variables. The warning I
encountered is about a failure to explicitly call the constructor for
the base class.
I am guessing that addressing my warning would not cause any extra
code to be emitted, because it's just making an implicit base class
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at