xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/exception-spec-crash.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -DCXX_EXCEPTIONS -fsyntax-only -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc template <class _Tp> struct is_nothrow_move_constructible {
5*f4a2713aSLionel Sambuc   static const bool value = false;
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc template <class _Tp>
9*f4a2713aSLionel Sambuc class allocator;
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc template <>
12*f4a2713aSLionel Sambuc class allocator<char> {};
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc template <class _Allocator>
15*f4a2713aSLionel Sambuc class basic_string {
16*f4a2713aSLionel Sambuc   typedef _Allocator allocator_type;
17*f4a2713aSLionel Sambuc   basic_string(basic_string &&__str)
18*f4a2713aSLionel Sambuc   noexcept(is_nothrow_move_constructible<allocator_type>::value);
19*f4a2713aSLionel Sambuc };
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc class Foo {
22*f4a2713aSLionel Sambuc   Foo(Foo &&) noexcept = default;
23*f4a2713aSLionel Sambuc #ifdef CXX_EXCEPTIONS
24*f4a2713aSLionel Sambuc // expected-error@-2 {{does not match the calculated}}
25*f4a2713aSLionel Sambuc #else
26*f4a2713aSLionel Sambuc // expected-no-diagnostics
27*f4a2713aSLionel Sambuc #endif
28*f4a2713aSLionel Sambuc   Foo &operator=(Foo &&) noexcept = default;
29*f4a2713aSLionel Sambuc   basic_string<allocator<char> > vectorFoo_;
30*f4a2713aSLionel Sambuc };
31