[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / P1155.cpp
blob6dcbaa750557dff186fb89304767f945c46ca013
1 // RUN: %clang_cc1 -std=c++2b -fsyntax-only -fcxx-exceptions -verify %s
2 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify %s
3 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s
4 // expected-no-diagnostics
6 // Throwing
7 namespace test_throwing {
8 class Widget {
9 public:
10 Widget(Widget &&);
11 Widget(const Widget &) = delete;
14 void seven(Widget w) {
15 throw w;
17 } // namespace test_throwing
19 // Non-constructor conversion
20 namespace test_non_constructor_conversion {
21 class Widget {};
23 struct To {
24 operator Widget() const & = delete;
25 operator Widget() &&;
28 Widget nine() {
29 To t;
30 return t;
32 } // namespace test_non_constructor_conversion
34 // By-value sinks
35 namespace test_by_value_sinks {
36 class Widget {
37 public:
38 Widget();
39 Widget(Widget &&);
40 Widget(const Widget &) = delete;
43 struct Fowl {
44 Fowl(Widget);
47 Fowl eleven() {
48 Widget w;
49 return w;
51 } // namespace test_by_value_sinks
53 // Slicing
54 namespace test_slicing {
55 class Base {
56 public:
57 Base();
58 Base(Base &&);
59 Base(Base const &) = delete;
62 class Derived : public Base {};
64 Base thirteen() {
65 Derived result;
66 return result;
68 } // namespace test_slicing