New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 616117 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Mojo Feature Request: Generate Clone method for Structs with custom types

Project Member Reported by ortuno@chromium.org, May 31 2016

Issue description

I noticed that a Clone method is not generated for Structs with Custom Types. It would be nice if we could implement a Clone method for our Custom Types, have the code generator check if the Clone method was implemented and generate the Clone method for the Struct containing the type.
 

Comment 1 by yzshen@chromium.org, May 31 2016

Cc: sa...@chromium.org
Sam's recent change should solve the problem:
https://codereview.chromium.org/2012693002/
With this change, Clone() tries to use the custom type's copy assignment operator. (The custom type doesn't have to have this operator if no one actually uses it.)

One thing may be useful is to also support optional Clone() in StructTraits. If that function is not provided, fall back to copy assignment.

Comment 2 by ortuno@chromium.org, May 31 2016

Sam's patch does solve our problem. The Clone method in StructTraits might be useful for other people, but Sam's patch is enough to solve our problem. I'll leave it up to you to decide if you want to close this issue.

Comment 3 by yzshen@chromium.org, May 31 2016

Status: WontFix (was: Untriaged)
Thanks for the update and glad that it fixes your problem.

Sign in to add a comment