C++11 code gen bug for enums with default values
I've stumbled across a problem with the header file generated by slice2cpp (3.7.0, but having tracked the problem still present in 3.7.1-rc1)
Given an Ice enumeration, a C++ enum class is created, all is well.
Given an Ice class containing an instance of that enumeration with a default value, the generated constructor is incorrect. Specifically, the field initialiser is missing the enumeration name as required by enum class.
I've looked at the code (
slice2cpp/Gen.cpp) and it appears that none of the calls to
writeDataMemberInitializers set the
cpp11 flag, which defaults to false. I have a patch which addresses this, setting it false in all cases expect for
Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart, which sets it to true. This fixes the problem I have, but I wouldn't claim my testing is comprehensive. I can post the patch for review if desired.