Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CXX/special/class.copy/p20.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s | |
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s | |
3 | |
4 struct ConstCopy { | |
5 ConstCopy(); | |
6 ConstCopy &operator=(const ConstCopy&); | |
7 }; | |
8 | |
9 struct NonConstCopy { | |
10 NonConstCopy(); | |
11 NonConstCopy &operator=(NonConstCopy&); | |
12 }; | |
13 | |
14 struct VirtualInheritsNonConstCopy : virtual NonConstCopy { | |
15 VirtualInheritsNonConstCopy(); | |
16 VirtualInheritsNonConstCopy &operator=(const VirtualInheritsNonConstCopy&); | |
17 }; | |
18 | |
19 struct ImplicitNonConstCopy1 : NonConstCopy { // expected-note{{the implicit copy assignment operator}} | |
20 ImplicitNonConstCopy1(); | |
21 }; | |
22 | |
23 struct ImplicitNonConstCopy2 { // expected-note{{the implicit copy assignment operator}} | |
24 ImplicitNonConstCopy2(); | |
25 NonConstCopy ncc; | |
26 }; | |
27 | |
28 struct ImplicitNonConstCopy3 { // expected-note{{the implicit copy assignment operator}} | |
29 ImplicitNonConstCopy3(); | |
30 NonConstCopy ncc_array[2][3]; | |
31 }; | |
32 | |
33 struct ImplicitNonConstCopy4 : VirtualInheritsNonConstCopy { | |
34 ImplicitNonConstCopy4(); | |
35 }; | |
36 | |
37 void test_non_const_copy(const ImplicitNonConstCopy1 &cincc1, | |
38 const ImplicitNonConstCopy2 &cincc2, | |
39 const ImplicitNonConstCopy3 &cincc3, | |
40 const ImplicitNonConstCopy4 &cincc4, | |
41 const VirtualInheritsNonConstCopy &vincc) { | |
42 (void)sizeof(ImplicitNonConstCopy1() = cincc1); // expected-error{{no viable overloaded '='}} | |
43 (void)sizeof(ImplicitNonConstCopy2() = cincc2); // expected-error{{no viable overloaded '='}} | |
44 (void)sizeof(ImplicitNonConstCopy3() = cincc3); // expected-error{{no viable overloaded '='}} | |
45 (void)sizeof(ImplicitNonConstCopy4() = cincc4); // okay | |
46 (void)sizeof(VirtualInheritsNonConstCopy() = vincc); | |
47 } |