<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 12, 2017 at 12:33 AM, John Emmas <span dir="ltr"><<a href="mailto:johne53@tiscali.co.uk" target="_blank">johne53@tiscali.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10/01/2017 19:04, John Emmas wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
My guess is that with those specific types (LayerModel / BufferingPreset etc) the DEFINE_ENUM_CONVERT macro is somehow getting called with a type that's considered invalid (and it therefore ends up at T::TO_STRING_TEMPLATE_NOT_DEFI<wbr>NED_FOR_THIS_TYPE).<br>
<br>
The affected types (at least, the ones I've looked at so far) appear to be enums - so maybe there's some difference in the way VC++ handles enums, compared to gcc?<br>
<br>
</blockquote>
<br></span>
Yes, the problem seems to be specific to enum types - and in fact, Tim's code is doing exactly what it's designed to do (i.e. it's trapping out an invalid data type).<br>
<br>
In gcc, enums are most likely implemented via one of the basic types ('int' maybe?)  But for MSVC, 'enum' seems to be a type in its own right.  I found a few sites which seemed to suggest that it's effectively 'const int' so I changed Tim's functions to require const parameters (like this example):-<br>
<br>
      template <class T><br>
      inline bool to_string (int32_t val, std::string& str)<br>
      {<br>
          return int32_to_string (val, str);<br>
      }<br>
<br>
which got changed to this:-<br>
<br>
      template <class T><br>
      inline bool to_string (const int32_t val, std::string& str)<br>
      {<br>
          return int32_to_string (val, str);<br>
      }<br>
<br>
However, for enum types, that still doesn't make any difference and I'm not sure what else I can try.  I've asked for help on an MSVC programming forum but unless someone comes up with a solution, it looks like merging in the string_convert stuff might make Ardour unbuildable with MSVC... :-(</blockquote><div><br></div><div>Hi John,</div><div><br></div><div>I haven't had much time to look into this over the last few days but I did write a basic test case for Visual Studio 2015/MSVC14 and it seems the template specialization for enum types works as expected/correctly. It is fairly basic use of templates so I'd be surprised if there was a problem with that part of the code.</div><div><br></div><div>Are you also building the libpbd unit tests as part of your MSVC build? and do they pass?</div><div><br></div><div>I'm not setup to build libardour/libpbd and dependencies with MSVC but I'll continue to try and expand the test case to reproduce your issue.</div><div><br></div><div>Can you please send me (privately) the relevant compiler error/output.</div><div><br></div><div>Thanks,</div><div><br></div><div>Tim</div></div><br></div></div>