opnsense-src/test/SemaTemplate/instantiate-default-assignment-operator.cpp

18 lines
602 B
C++
Raw Normal View History

2010-01-01 05:34:51 -05:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
2009-12-15 13:49:47 -05:00
template<typename> struct PassRefPtr { };
template<typename T> struct RefPtr {
RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array with a negative size}}
2009-12-15 13:49:47 -05:00
RefPtr& operator=(const PassRefPtr<T>&);
};
2010-05-04 12:12:48 -04:00
struct A { RefPtr<int> a; }; // expected-note {{instantiation of member function 'RefPtr<int>::operator=' requested here}}
struct B : RefPtr<float> { }; // expected-note {{in instantiation of member function 'RefPtr<float>::operator=' requested here}}
2009-12-15 13:49:47 -05:00
void f() {
A a1, a2;
2010-05-04 12:12:48 -04:00
a1 = a2;
2009-12-15 13:49:47 -05:00
B b1, b2;
2010-05-04 12:12:48 -04:00
b1 = b2;
2009-12-15 13:49:47 -05:00
}