You can download the 12.4 beta from here:
The code snippet compiles with the 12.4 beta.
We substantially improved our standard compliance for the template code in 12.4.
Previous versions of Studio C++ were indeed somewhat lacking in that area...
I tried to find this download through Oracle site but only found a site where 12.4 beta was only available for premium members.
I hope the earlier link enabled you to try out the beta. Let us know if you have any feedback.
I'll give it a try, it is very good news that Solaris C++ supports C++11 at last.
Regarding the earlier versions and Fedor's opinion:
I faced some bugs in template area but most of the time there is an easy workaround. In case of automatic conversion from array arguments lots of manual work is required (adding array overloads for all methods which use array_ref).
Still, I find CC quite a decent compiler wrt. templates, requiring less workarounds than e.g. earlier VC++.
As for the other areas of standard, this is probably the only compiler which puts <cmath>, <cstring> and other <cXXX> headers in std namespace only, without polluting the global namespace.
Also, CC's optimizer is very good, producing faster code than gcc in many cases.
Great! Thanks for the comments.
> Still, I find CC quite a decent compiler wrt. templates, requiring less workarounds than e.g. earlier VC++.
Well, not that much of an achievement... too many compilers around are better with templates than earlier VC++
> the only compiler which puts <cmath>, <cstring> and other <cXXX> headers in std namespace only
Yeah, and that gives us some troubles
Say, Boost has quite a number of bugs when they use standard functions like strcpy from a global namespace.
And as Studio is pretty much the only compiler who fails to compile the code because of this,
people naturally start blaming our compiler...
Well, Boost tends to fix these bugs as we report them, but then they introduce new ones of the same nature.
I can confirm that automatic conversion from template arguments, both const and non-const works on 12.4, even in c++03 mode.
The only problem I will face in my project is that -std=c++11 cannot be used together with -library=Cstd. We are using a 3-rd party library (binary only) which is only available for libCstd which means we will not be able to use the new standard
I can understand though, that it is not possible to handle two standards with one ABI which is why a different standard library has to be used with C++11.
Another interesting thing:
CC does not allow classes (even POD-like) with assignment operator in unions. This is absolutely correct and standard-compliant in C++03 mode but g++ somehow seems to allow classes with simple types only to be members of unions regardless of the existance of assignment operators.
This "feature" is used in Qt 5 (json library) and LLVM (a number of unions containing types from Endian.h) and breaks (correcly!) compilation under CC. Thus, Boost is not the only one example of taking g++ as a standard instead of reading the language specification