id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 6655,Inclusion of causes valid code to fail to compile with Clang,Alexander Korsunsky ,Frank Mori Hess,"The following well-formed program does not compile with Clang 3.1 (from trunk): {{{ #include #include int main() { std::shared_ptr s; } }}} The error message is: {{{ signals2-bug.cpp:6:26: error: implicit instantiation of undefined template 'std::shared_ptr' std::shared_ptr s; ^ /home/alexander/usr/local/include/boost/signals2/detail/foreign_ptr.hpp:24:30: note: template is declared here template class shared_ptr; ^ }}} The header boost/signals2/detail/foreign_ptr.hpp declares two names in the std:: namespace: {{{ #if !defined(BOOST_INTEL_STDCXX0X) namespace std { template class shared_ptr; template class weak_ptr; } #endif }}} which is undefined behaviour, according to the Standard 17.6.4.2.1: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited. The compilation succeeds, if either the #include of is removed, or the offending lines are commented out. Please remove the offending lines from the header. ",Bugs,closed,Boost 1.50.0,signals2,Boost 1.49.0,Problem,fixed,,