1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple %itanium_abi_triple %s -S -emit-llvm -o - | FileCheck %s 2f4a2713aSLionel Sambuc // PR4262 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc // CHECK-NOT: _ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag 5f4a2713aSLionel Sambuc 6f4a2713aSLionel Sambuc // The "basic_string" extern template instantiation declaration is supposed to 7f4a2713aSLionel Sambuc // suppress the implicit instantiation of non-inline member functions. Make sure 8f4a2713aSLionel Sambuc // that we suppress the implicit instantiation of non-inline member functions 9f4a2713aSLionel Sambuc // defined out-of-line. That we aren't instantiating the basic_string 10f4a2713aSLionel Sambuc // constructor when we shouldn't be. Such an instantiation forces the implicit 11f4a2713aSLionel Sambuc // instantiation of _S_construct<const char*>. Since _S_construct is a member 12f4a2713aSLionel Sambuc // template, it's instantiation is *not* suppressed (despite being in 13f4a2713aSLionel Sambuc // basic_string<char>), so we would emit it as a weak definition. 14f4a2713aSLionel Sambuc 15f4a2713aSLionel Sambuc #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) 16f4a2713aSLionel Sambuc #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 17f4a2713aSLionel Sambuc #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) 18f4a2713aSLionel Sambuc #if (__has_feature(cxx_noexcept)) 19f4a2713aSLionel Sambuc # define _NOEXCEPT noexcept 20f4a2713aSLionel Sambuc # define _NOEXCEPT_(x) noexcept(x) 21f4a2713aSLionel Sambuc #else 22f4a2713aSLionel Sambuc # define _NOEXCEPT throw() 23f4a2713aSLionel Sambuc # define _NOEXCEPT_(x) 24f4a2713aSLionel Sambuc #endif 25f4a2713aSLionel Sambuc 26f4a2713aSLionel Sambuc namespace std // purposefully not using versioning namespace 27f4a2713aSLionel Sambuc { 28f4a2713aSLionel Sambuc 29f4a2713aSLionel Sambuc template<class charT> struct char_traits; 30f4a2713aSLionel Sambuc template<class T> class allocator; 31f4a2713aSLionel Sambuc template <class _CharT, 32f4a2713aSLionel Sambuc class _Traits = char_traits<_CharT>, 33f4a2713aSLionel Sambuc class _Allocator = allocator<_CharT> > 34f4a2713aSLionel Sambuc class _LIBCPP_VISIBLE basic_string; 35f4a2713aSLionel Sambuc typedef basic_string<char, char_traits<char>, allocator<char> > string; 36f4a2713aSLionel Sambuc 37f4a2713aSLionel Sambuc class _LIBCPP_EXCEPTION_ABI exception 38f4a2713aSLionel Sambuc { 39f4a2713aSLionel Sambuc public: exception()40f4a2713aSLionel Sambuc _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} 41f4a2713aSLionel Sambuc virtual ~exception() _NOEXCEPT; 42f4a2713aSLionel Sambuc virtual const char* what() const _NOEXCEPT; 43f4a2713aSLionel Sambuc }; 44f4a2713aSLionel Sambuc 45f4a2713aSLionel Sambuc class _LIBCPP_EXCEPTION_ABI runtime_error 46f4a2713aSLionel Sambuc : public exception 47f4a2713aSLionel Sambuc { 48f4a2713aSLionel Sambuc private: 49f4a2713aSLionel Sambuc void* __imp_; 50f4a2713aSLionel Sambuc public: 51f4a2713aSLionel Sambuc explicit runtime_error(const string&); 52f4a2713aSLionel Sambuc explicit runtime_error(const char*); 53f4a2713aSLionel Sambuc 54f4a2713aSLionel Sambuc runtime_error(const runtime_error&) _NOEXCEPT; 55f4a2713aSLionel Sambuc runtime_error& operator=(const runtime_error&) _NOEXCEPT; 56f4a2713aSLionel Sambuc 57f4a2713aSLionel Sambuc virtual ~runtime_error() _NOEXCEPT; 58f4a2713aSLionel Sambuc 59f4a2713aSLionel Sambuc virtual const char* what() const _NOEXCEPT; 60f4a2713aSLionel Sambuc }; 61f4a2713aSLionel Sambuc 62f4a2713aSLionel Sambuc } 63f4a2713aSLionel Sambuc dummysymbol()64f4a2713aSLionel Sambucvoid dummysymbol() { 65f4a2713aSLionel Sambuc throw(std::runtime_error("string")); 66f4a2713aSLionel Sambuc } 67