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