Closed timotheecour closed 7 years ago
figured out what was happening:
template protoType(string Tname, string file_protodef){
enum protodef=import(file_protodef);
import dproto.dproto;
mixin ProtocolBufferFromString!protodef;
mixin("alias protoType="~Tname~";");
}
// NOTE: defs.proto contains messages
alias Mymsg=protoType!("Mymsg","defs.proto");
alias MymsgAux=protoType!("MymsgAux","defs.proto");
Mymsg proto;
proto.a2 = MyMsgAux(); // Error: template std.typecons.Nullable!(MyMsgAux).Nullable.opAssign cannot deduce function from argument types !()(MyMsgAux)
Unfortunately, the error message was very confusing since the name MyMsgAux
matches.
message MymsgAux{ optional string foo1=1; }
message Mymsg{ required MymsgAux a1=1; optional MymsgAux a2=2; }
Mymsg proto; proto.a1.foo1="bar"; // ok proto.a2.foo1="bar"; // Called `get' on null Nullable!MymsgAux
Adding
proto.a2 = MyMsgAux();
gave: Error: template std.typecons.Nullable!(MyMsgAux).Nullable.opAssign cannot deduce function from argument types !()(MyMsgAux)