Cc: ken...@google.com

Comment #1 on issue 312 by liuj...@google.com: Required field with default value serializes if not set

Thanks for reporting this. The problem is the GOOGLE_DCHECK(only check in debug mode, will be a no-op in opt mode).

SerializeToCodedStream uses DCHECK: GOOGLE_DCHECK(IsInitialized()) ...
But the MergeFromCodedStream checks that explicitly.
if (!message->IsInitialized()) {
  return false;

The DCHECK in message_lite.cc is discarded when you install the protobuf library, which is built in OPT mode.

It seems to be problematic in opensource release, as all the DCHECKs are basically discarded after user installs the libprotobuf. One way to fix this is to move the DCHECK() from message_lite.cc to generated classses. So developers will have a chance to hit the DCHECK() when they build the generated code in debug mode. The issue still remains for rest of DCHECKS in libprotobuf though..

You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to