1 // Copyright 2020 Peter Dimov 2 // Distributed under the Boost Software License, Version 1.0. 3 // https://www.boost.org/LICENSE_1_0.txt 4 5 #include <boost/shared_ptr.hpp> 6 #include <boost/smart_ptr/enable_shared_from.hpp> 7 8 struct X: public boost::enable_shared_from 9 { 10 }; 11 12 #if defined(__clang__) && defined(_MSC_VER) 13 // clang-cl claims that it accepts this code for compatibility 14 // with msvc, but no version of msvc accepts it 15 # pragma clang diagnostic error "-Wmicrosoft-using-decl" 16 #endif 17 main()18int main() 19 { 20 boost::shared_ptr<X> px( new X ); 21 px->shared_from_this(); 22 } 23