<html><body><div>Hi Dirk,</div><div><br></div><div>Here is a more detailed summary of the change and some test results</div><div><br></div><div><div>Things affected by the change</div><div>=============================</div><div><br></div><div>* The use of <initializer_list>, <unordered_map> and <unordered_set> header</div><div>* The use C++11 static assert and variadic template</div><div><br></div><div>Things work before the change</div><div>=============================</div><div><br></div><div>GCC, Clang, Intel, SunPro in C++98 mode</div><div>TR1 headers are used if some macros defined, otherwise ordered map and set are</div><div>used.</div><div><br></div><div>Earlier GCC in C++0x mode (up to version 4.6 series)</div><div><br></div><div>Things do not work before the change</div><div>====================================</div><div><br></div><div>Any compiler with __cplusplus >= 201103L, Clang, Intel, GCC 4.7 with -std=c++0x</div><div>This is due to the fact that Rcpp/sugar/sets.h has the following code</div><div><br></div><div>#if __cplusplus >= 201103L</div><div>    #define RCPP_UNORDERED_SET std::unordered_set</div><div>    #define RCPP_UNORDERED_MAP std::unordered_map</div><div>#elif defined(HAS_TR1_UNORDERED_SET)</div><div>    #define RCPP_UNORDERED_SET std::tr1::unordered_set</div><div>    #define RCPP_UNORDERED_MAP std::tr1::unordered_map</div><div>#else</div><div>    #define RCPP_UNORDERED_SET std::set</div><div>    #define RCPP_UNORDERED_MAP std::map</div><div>#endif</div><div><br></div><div>while C++11 <unordered_map> and <unordered_set> are not included anywhere</div><div><br></div><div>Clang with libc++</div><div>Similar reasons. libc++ does not provide TR1 headers but only C++98 and C++11</div><div>headers</div><div><br></div><div>The change</div><div>==========</div><div><br></div><div>If the compiler is in a C++0x/11 mode, (-std=c++0x, or -std=c++11), then choose</div><div><unordered_map> and <unordered_set> if possible. Otherwise choose <map> and</div><div><set></div><div><br></div><div>If the compiler is in a C++98 mode, (usually the default), then choose</div><div><tr1/unordered_map> and <tr1/unordered_set> if possible. Otherwise choose <map></div><div>and <set></div><div><br></div><div>We do not try to choose TR1 headers in C++11 mode. Some testing shows very</div><div>wired errors in this combinations when using intel compilers.</div><div><br></div><div>However, the GCC is an exception. Even when in C++11 mode, GCC will always try</div><div>to use TR1 headers instead of C++11 headers. This is for backward</div><div>compatibility, to void breaking of ABI. If this is not desired, remove the</div><div>comment before #define HAS_CXX0X_FLAG in the following (line 107)</div><div><br></div><div>...</div><div>#elif defined(__GNUC__)</div><div>    #ifdef __GXX_EXPERIMENTAL_CXX0X__</div><div>        // #define HAS_CXX0X_FLAG</div><div>        #if GCC_VERSION >= 40300</div><div>            // #define HAS_VARIADIC_TEMPLATES</div><div>            #define HAS_STATIC_ASSERT</div><div>        #endif</div><div>    #endif</div><div>#endif</div><div>...</div><div><br></div><div>C++11 static assert feature is properly tested for the four</div><div>GOOD_COMPILER_FOR_RCPP.</div><div><br></div><div>C++11 variadic templates are disabled for all compilers. This clearly does not</div><div>affect C++98 implementation. In C++11 mode, when this feature is enabled, my</div><div>test results showed some wired error emitted from basename, which was called by</div><div>sourceCppContext. This may need some further investigation. I believe this is</div><div>not due to the change made here. The compilers I tried was Intel icpc 13, GCC</div><div>4.6 and 4.7. They all have the same problem when variadic templates are</div><div>enabled.</div><div><br></div><div>C++11 <initializer_list> is also properly tested for each of the four compilers</div><div><br></div><div>A small glitch in Rcpp/traits/comparator_type.h is fixed. This is found when</div><div>running the Unit tests with Clang, which somehow is more strict than GCC.</div><div><br></div><div>Things work the same way before AND after the change</div><div>=====================================================</div><div><br></div><div>The four compilers in C++98 mode</div><div>The ABI shall be unchanged for these situations. At least this is the</div><div>intention, everything depend on Rcpp shall not need to be rebuilt. But maybe</div><div>some carelessness invalidate this claim. More testing on this front are needed.</div><div><br></div><div>Things break before still break anyway.</div><div><br></div><div>Things work after the change BUT not before</div><div>===========================================</div><div><br></div><div>Clang with libc++ in C++98 and C++11 mode, -std=c++98 or -std=c++0x;</div><div>-stdlib=libc++</div><div><br></div><div>Intel icpc in C++11 mode, -std=c++0x</div><div><br></div><div>GCC 4.7 in C++11 mode, -std=c++0x</div><div><br></div><div>Compilers tested</div><div>================</div><div><br></div><div>The following are compilers tested, within each paragraph, the first line is</div><div>compiler version and platform. The second and third lines are the C and C++</div><div>compilers and flags used when building R. The R configure script may add</div><div>additional flags like -std=gnu99. Building R only uses the C compiler and C</div><div>flags. However the configure script capture the C++ compiler and flags for use</div><div>when, e.g., R CMD INSTALL Rcpp</div><div><br></div><div>All tests are peformed with R 2.15.2 patched</div><div><br></div><div>Mac OS X Mountain Lion 10.8.2, Xcode 4.5.2, clang 4.1 (based on LLVM 3.1svn)</div><div>clang</div><div>clang++ -std=c++98 -stdlib=libc++</div><div><br></div><div>Mac OS X Mountain Lion 10.8.2, Xcode 4.5.2, clang 4.1 (based on LLVM 3.1svn)</div><div>clang</div><div>clang++ -std=c++11 -stdlib=libc++</div><div><br></div><div>Mac OS X Mountain Lion 10.8.2, Xcode 4.5.2, clang 4.1 (based on LLVM 3.1svn)</div><div>clang</div><div>clang++ -std=c++98 -stdlib=libstdc++</div><div><br></div><div>Mac OS X Mountain Lion 10.8.2, Xcode 4.5.2, clang 4.1 (based on LLVM 3.1svn)</div><div>clang</div><div>clang++ -std=c++11 -stdlib=libstdc++</div><div><br></div><div>The official build of R on Mac OS X use GCC 4.2.1 on Mac OS X Leopard, which is</div><div>a legacy system I don't have access any more.</div><div><br></div><div>Ubuntu 12.10 Intel C++ 13.0.1</div><div>icc -std=gnu99 -gcc-name=gcc-4.7 -fp-model strict</div><div>icpc -std=c++98 -gcc-name=gcc-4.7 -gxx-name=g++-4.7 -fp-model strict</div><div><br></div><div>Ubuntu 12.10 Intel C++ 13.0.1</div><div>icc -std=gnu99 -gcc-name=gcc-4.7 -fp-model strict</div><div>icpc -std=c++11 -gcc-name=gcc-4.7 -gxx-name=g++-4.7 -fp-model strict</div><div><br></div><div>Ubuntu 12.10 GCC 4.7.2</div><div>gcc</div><div>g++ -std=c++98</div><div><br></div><div>Ubuntu 12.10 GCC 4.7.2</div><div>gcc</div><div>g++ -std=c++11</div><div><br></div><div>Test results</div><div>============</div><div><br></div><div>Rcpp Unit Test</div><div>--------------</div><div><br></div><div>The following are the Rcpp Unit Test results for the tested compilers above.</div><div>The links are named as platform-C++Compiler-std=Lang.html</div><div><br></div><div>http://www.yan-zhou.com/rcppunit/mac-clang++-std=c++98-stdlib=libstdc++.html</div><div>http://www.yan-zhou.com/rcppunit/mac-clang++-std=c++98-stdlib=libc++.html</div><div>http://www.yan-zhou.com/rcppunit/mac-clang++-std=c++11-stdlib=libstdc++.html</div><div>http://www.yan-zhou.com/rcppunit/mac-clang++-std=c++11-stdlib=libc++.html</div><div>http://www.yan-zhou.com/rcppunit/linux-icpc-std=c++98.html</div><div>http://www.yan-zhou.com/rcppunit/linux-icpc-std=c++11.html</div><div>http://www.yan-zhou.com/rcppunit/linux-g++-std=c++98.html</div><div>http://www.yan-zhou.com/rcppunit/linux-g++-std=c++11.html</div><div><br></div><div>As shown in those pages, most compilers works well. With Intel Compiler and</div><div>Clang with libc++, in C++11 mode, two tests fails. These may need some further</div><div>investigation. It could be problems with compiler or the code in Rcpp. Either</div><div>way, since these compilers do no work at all previously, I consider this a</div><div>improvement.</div><div><br></div><div>Rcpp and RInside examples</div><div>-------------------------</div><div><br></div><div>These all works well without any problem as far as I can tell</div><div><br></div><div>Packages distributed in Rcpp SVN repository</div><div>-------------------------------------------</div><div><br></div><div>RcppCImg, RcppModels cannot compile due to some C++ issues. I believe they are</div><div>not due to the changes as the same error happens when using GCC and a SVN</div><div>version of Rcpp without the changes. RcppParDE has some dependencies I cannot</div><div>find.</div><div><br></div><div>When using Clang on Mac OS X without libc++ but using -std=c++11, RcppEigen and</div><div>RcppArmadillo failed to build. However those are due the two libraries made</div><div>some wrong assumption about the existence of some C++11 headers. With clang</div><div>-std=c++11-stdlib=libstdc++ on Mac OS X, __cplusplus test will give the wrong</div><div>impression that C++11 is supported, while the libstdc++ on Mac OS X is still</div><div>the GCC 4.2.1 version, which does not have any C++11 support. These issues</div><div>shall be fixed in the upstream projects rather than within Rcpp.</div><div><br></div><div>Other packages build successfully and examples work well.</div><div><br></div><div>Packages depend on Rcpp</div><div>-----------------------</div><div><br></div><div>There are about 90 such packages. Most of them built well. But more tests are</div><div>needed.</div></div><div><br></div><div>Best,</div><div><br></div><div>Yan Zhou</div></body></html>