1 // RUN: %clang_cc1 -std=c++23 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23,cxx23 %s
2 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23 %s
3 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -fblocks -verify=cxx98_23,cxx11_23 %s
4 // RUN: %clang_cc1 -std=c++98 -fsyntax-only -fobjc-arc -fblocks -Wno-c++11-extensions -verify=cxx98_23,cxx98 %s
6 #define TEST(T) void test_##T() { \
8 (void)^(void) { (void)x; }; \
12 CopyOnly(); // cxx23-note {{not viable}}
13 CopyOnly(CopyOnly &); // cxx23-note {{not viable}}
15 TEST(CopyOnly); // cxx23-error {{no matching constructor}}
17 // Both ConstCopyOnly and NonConstCopyOnly are
18 // "pure" C++98 tests (pretend 'delete' means 'private').
19 // However we may extend implicit moves into C++98, we must make sure the
20 // results in these are not changed.
21 struct ConstCopyOnly {
23 ConstCopyOnly(ConstCopyOnly &) = delete; // cxx98-note {{marked deleted here}}
24 ConstCopyOnly(const ConstCopyOnly &);
26 TEST(ConstCopyOnly); // cxx98-error {{call to deleted constructor}}
28 struct NonConstCopyOnly {
30 NonConstCopyOnly(NonConstCopyOnly &);
31 NonConstCopyOnly(const NonConstCopyOnly &) = delete; // cxx11_23-note {{marked deleted here}}
33 TEST(NonConstCopyOnly); // cxx11_23-error {{call to deleted constructor}}
37 CopyNoMove(CopyNoMove &);
38 CopyNoMove(CopyNoMove &&) = delete; // cxx98_23-note {{marked deleted here}}
40 TEST(CopyNoMove); // cxx98_23-error {{call to deleted constructor}}
44 MoveOnly(MoveOnly &) = delete;
45 MoveOnly(MoveOnly &&);
51 NoCopyNoMove(NoCopyNoMove &) = delete;
52 NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx98_23-note {{marked deleted here}}
54 TEST(NoCopyNoMove); // cxx98_23-error {{call to deleted constructor}}
56 struct ConvertingRVRef {
58 ConvertingRVRef(ConvertingRVRef &) = delete;
61 ConvertingRVRef(X &&);
62 operator X() const & = delete;
65 TEST(ConvertingRVRef);
67 struct ConvertingCLVRef {
69 ConvertingCLVRef(ConvertingCLVRef &);
72 ConvertingCLVRef(X &&); // cxx98_23-note {{passing argument to parameter here}}
74 operator X() && = delete; // cxx98_23-note {{marked deleted here}}
76 TEST(ConvertingCLVRef); // cxx98_23-error {{invokes a deleted function}}
79 struct SubMove : SubSubMove {
81 SubMove(SubMove &) = delete;
83 SubMove(SubSubMove &&);