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