brintos

brintos / llvm-project-archived public Read only

0
0
Text · 951 B · c58bd7c Raw
30 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3template<class T, class V>4struct A{5    A(); // expected-note{{candidate constructor not viable: requires 0 arguments, but 1 was provided}}6    A(A&); // expected-note{{candidate constructor not viable: expects an lvalue for 1st argument}} 7    A(A<V, T>); // expected-error{{copy constructor must pass its first argument by reference}}8};9 10void f() {11    A<int, int> a = A<int, int>(); // expected-note{{in instantiation of template class 'A<int, int>'}} 12    A<int, double> a1 = A<double, int>(); // No error (not a copy constructor)13}14 15// Test rvalue-to-lvalue conversion in copy constructor16A<int, int> &&a(void);17void g() {18    A<int, int> a2 = a(); // expected-error{{no matching constructor}}19}20 21template<class T, class V>22struct B{23    B();24    template<class U> B(U); // No error (templated constructor)25};26 27void h() {28    B<int, int> b = B<int, int>(); // should use implicit copy constructor29}30