Details
-
Bug
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
None
-
Service Arch
Description
Given an IDL defined in the namespace mongo (i.e. set to global.cpp_namespace) that defines a customer type with the serializer/deserializer functions in a nested namespace (e.g., mongo::util), the generated code doesn't take into account the specified namespace for the serializer/deserializer functions, causing a symbol not found error at compiling time.
More in details, given the following IDL:
global:
|
cpp_namespace: "mongo" |
...
|
|
|
types:
|
status:
|
bson_serialization_type: any
|
cpp_type: "mongo::Status" |
serializer: "mongo::util::serializeStatusToBSON" |
deserializer: "mongo::util::deserializeStatusFromBSON" |
...
|
|
|
structs:
|
CoordinatorMetadata
|
...
|
fields:
|
error:
|
type: status
|
The compiler generates the following code:
namespace mongo {
|
...
|
|
|
void CoordinatorMetadata::serialize(BSONObjBuilder* builder) const { |
...
|
if (_error) { |
serializeStatusToBSON((*_error), kErrorFieldName, builder);
|
}
|
...
|
}}
|
The problem is that the function serializeStatusToBSON is defined in the namespace mongo::util, not in mongo.