[ 
https://issues.apache.org/jira/browse/THRIFT-2105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Strisovsky updated THRIFT-2105:
----------------------------------------

    Attachment: thrift-jira-thrift-2105-fixed_print_const_value.patch

Adding patch for issue in print_const_value ( t_cpp_generator.cpp) Jira 
Thrift-2105 issue, Please review it and push to main branch.
                
> Generated code for default values of collections ignores t_field::T_REQUIRED
> ----------------------------------------------------------------------------
>
>                 Key: THRIFT-2105
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2105
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Compiler
>            Reporter: Vladimir Strisovsky
>         Attachments: thrift-jira-thrift-2105-fixed_print_const_value.patch
>
>
> I have very simple thrift structure:
> struct FloatProcessValue
> {
>     1: required ID id,
>     2: required Value value
> }
> FloatProcessValue contains only required fileds, so no __isset structure is 
> generated. But when this structure is used in collection with some default 
> values:
> 4: required map<i32, basic_types.FloatProcessValue> mapi32ToFloat = { 
> 1:{'id':0, 'value':0.4}},
> compilation fails because constructor tries to set __isset.value and 
> __isset.id
>      ::simpletest::FloatProcessValue tmp0;
>      ::simpletest::ID tmp1;
>     tmp1 = 0;
>     tmp0.id = tmp1;
>     tmp0.__isset.id = true; // error: ‘class simpletest::FloatProcessValue’ 
> has no member named ‘__isset’
>      ::simpletest::Value tmp2;
>     tmp2 = 0.4;
>     tmp0.value = tmp2;
>     tmp0.__isset.value = true; error: ‘class simpletest::FloatProcessValue’ 
> has no member named ‘__isset’

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to