stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
138 stars 44 forks source link

Fix C++ reserved word mangling inside for loops #1243

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

First reported by @spinkney, our name mangling failed inside of for loops, e.g., the following would not compile:

transformed data {
   for (i in 1:2) {
    int switch = 2;
   }
}

Submission Checklist

Release notes

Fixed a bug where using a C++ reserved word as a name in certain situations would prevent compilation.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)