diff --git a/asn1_derive/src/lib.rs b/asn1_derive/src/lib.rs index 45f8867..ad7cba3 100644 --- a/asn1_derive/src/lib.rs +++ b/asn1_derive/src/lib.rs @@ -376,8 +376,9 @@ fn generate_read_element( }, }; if let Some(default) = default { + let f_type = &f.ty; read_op = quote::quote! {{ - asn1::from_optional_default(#read_op, #default.into())#add_error_location? + asn1::from_optional_default::<#f_type>(#read_op, #default.into())#add_error_location? }}; } read_op