Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2105

Generated code for default values of collections ignores t_field::T_REQUIRED

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.1
    • Component/s: C++ - Compiler
    • Labels:
      None

      Description

      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’

        Attachments

          Activity

            People

            • Assignee:
              carlyeks Carl Yeksigian
              Reporter:
              vstrisovsky Vladimir Strisovsky
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: