annotate clang/test/SemaCXX/overload-call-copycon.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wnon-pod-varargs
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wnon-pod-varargs
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 class X { }; // expected-note {{the implicit copy constructor}}
anatofuz
parents:
diff changeset
6 // expected-note@-1 {{the implicit default constructor}}
anatofuz
parents:
diff changeset
7 #if __cplusplus >= 201103L // C++11 or later
anatofuz
parents:
diff changeset
8 // expected-note@-3 {{candidate constructor (the implicit move constructor) not viable}}
anatofuz
parents:
diff changeset
9 #endif
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 int& copycon(X x); // expected-note{{passing argument to parameter}}
anatofuz
parents:
diff changeset
12 float& copycon(...);
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 void test_copycon(X x, X const xc, X volatile xv) {
anatofuz
parents:
diff changeset
15 int& i1 = copycon(x);
anatofuz
parents:
diff changeset
16 int& i2 = copycon(xc);
anatofuz
parents:
diff changeset
17 copycon(xv); // expected-error{{no matching constructor}}
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 class A {
anatofuz
parents:
diff changeset
21 public:
anatofuz
parents:
diff changeset
22 A(A&); // expected-note{{would lose const qualifier}} \
anatofuz
parents:
diff changeset
23 // expected-note{{no known conversion}}
anatofuz
parents:
diff changeset
24 };
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 class B : public A { }; // expected-note{{would lose const qualifier}} \
anatofuz
parents:
diff changeset
27 // expected-note{{would lose volatile qualifier}} \
anatofuz
parents:
diff changeset
28 // expected-note 2{{requires 0 arguments}}
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 short& copycon2(A a); // expected-note{{passing argument to parameter}}
anatofuz
parents:
diff changeset
31 int& copycon2(B b); // expected-note 2{{passing argument to parameter}}
anatofuz
parents:
diff changeset
32 float& copycon2(...);
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) {
anatofuz
parents:
diff changeset
35 int& i1 = copycon2(b);
anatofuz
parents:
diff changeset
36 copycon2(bc); // expected-error{{no matching constructor}}
anatofuz
parents:
diff changeset
37 copycon2(bv); // expected-error{{no matching constructor}}
anatofuz
parents:
diff changeset
38 short& s1 = copycon2(a);
anatofuz
parents:
diff changeset
39 copycon2(ac); // expected-error{{no matching constructor}}
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 int& copycon3(A a); // expected-note{{passing argument to parameter 'a' here}}
anatofuz
parents:
diff changeset
43 float& copycon3(...);
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 void test_copycon3(B b, const B bc) {
anatofuz
parents:
diff changeset
46 int& i1 = copycon3(b);
anatofuz
parents:
diff changeset
47 copycon3(bc); // expected-error{{no matching constructor}}
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 class C : public B { };
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 float& copycon4(A a);
anatofuz
parents:
diff changeset
53 int& copycon4(B b);
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 void test_copycon4(C c) {
anatofuz
parents:
diff changeset
56 int& i = copycon4(c);
anatofuz
parents:
diff changeset
57 };