blob: 31cdef59d9fd1a0470bbb2c795a11e2334780861 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlssonb6cc91b2009-12-09 03:01:51 +00002template<typename> struct PassRefPtr { };
3template<typename T> struct RefPtr {
Chandler Carruthb2b5cc02011-01-04 04:44:35 +00004 RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array with a negative size}}
Anders Carlssonb6cc91b2009-12-09 03:01:51 +00005 RefPtr& operator=(const PassRefPtr<T>&);
6};
7
Douglas Gregor06a9f362010-05-01 20:49:11 +00008struct A { RefPtr<int> a; }; // expected-note {{instantiation of member function 'RefPtr<int>::operator=' requested here}}
9struct B : RefPtr<float> { }; // expected-note {{in instantiation of member function 'RefPtr<float>::operator=' requested here}}
Anders Carlssonb6cc91b2009-12-09 03:01:51 +000010
11void f() {
12 A a1, a2;
Douglas Gregor06a9f362010-05-01 20:49:11 +000013 a1 = a2;
Anders Carlssonb6cc91b2009-12-09 03:01:51 +000014
15 B b1, b2;
Douglas Gregor06a9f362010-05-01 20:49:11 +000016 b1 = b2;
Anders Carlssonb6cc91b2009-12-09 03:01:51 +000017}