Gerrit Birkeland created AVRO-3990:
--------------------------------------

             Summary: [C++] avrogencpp generates invalid code for union with a 
reserved word
                 Key: AVRO-3990
                 URL: https://issues.apache.org/jira/browse/AVRO-3990
             Project: Apache Avro
          Issue Type: Bug
            Reporter: Gerrit Birkeland


When avrogencpp is run with this schema, it generates C++ code with compiler 
errors due to inconsistently passing names through the {{decorate}} wrapper.
{code}
{
  "type": "record",
  "name": "Record",
  "fields": [
    {
      "name": "void",
      "type": [
        "int",
        "double"
      ]
    }
  ]
}
{code}

This generates the following, note that the typedef uses {{void_t}} (one 
underscore) while references to the typedef use {{void__t}} (two underscores)

{code}
struct Record {
    typedef _cpp_reserved_words_union_typedef_Union__0__ void_t;
    void__t void_;
    Record() :
        void_(void__t())
        { }
};
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to