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

Gerrit Birkeland updated AVRO-3990:
-----------------------------------
    Description: 
When avrogencpp is run with this schema, it generates C++ code with compiler 
errors due to inconsistently passing names through the {{decorate}} wrapper.
{code:java}
{
  "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:java}
struct Record {
    typedef _cpp_reserved_words_union_typedef_Union__0__ void_t;
    void__t void_;
    Record() :
        void_(void__t())
        { }
};
{code}
Note: This problem was injected after the latest release, so can only be 
reproduced with a build off of the current repo.

  was:
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}


> [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
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When avrogencpp is run with this schema, it generates C++ code with compiler 
> errors due to inconsistently passing names through the {{decorate}} wrapper.
> {code:java}
> {
>   "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:java}
> struct Record {
>     typedef _cpp_reserved_words_union_typedef_Union__0__ void_t;
>     void__t void_;
>     Record() :
>         void_(void__t())
>         { }
> };
> {code}
> Note: This problem was injected after the latest release, so can only be 
> reproduced with a build off of the current repo.



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

Reply via email to