xref: /llvm-project/clang/test/CXX/special/class.copy/p28-cxx11.cpp (revision 52c0b58d33385417567a404149570fd2b6895c91)
1*52c0b58dSRichard Smith // RUN: %clang_cc1 -std=c++98 %s -fsyntax-only
2*52c0b58dSRichard Smith // RUN: %clang_cc1 -std=c++11 %s -verify
3*52c0b58dSRichard Smith 
4*52c0b58dSRichard Smith // In C++11, we must perform overload resolution to determine which function is
5*52c0b58dSRichard Smith // called by a defaulted assignment operator, and the selected operator might
6*52c0b58dSRichard Smith // not be a copy or move assignment (it might be a specialization of a templated
7*52c0b58dSRichard Smith // 'operator=', for instance).
8*52c0b58dSRichard Smith struct A {
9*52c0b58dSRichard Smith   A &operator=(const A &);
10*52c0b58dSRichard Smith 
11*52c0b58dSRichard Smith   template<typename T>
operator =A12*52c0b58dSRichard Smith   A &operator=(T &&) { return T::error; } // expected-error {{no member named 'error' in 'A'}}
13*52c0b58dSRichard Smith };
14*52c0b58dSRichard Smith 
15*52c0b58dSRichard Smith struct B : A {
16*52c0b58dSRichard Smith   B &operator=(B &&);
17*52c0b58dSRichard Smith };
18*52c0b58dSRichard Smith 
19*52c0b58dSRichard Smith B &B::operator=(B &&) = default; // expected-note {{here}}
20