[cfe-commits] r158186 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/cxx0x-defaulted-functions.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Thu Jun 7 18:30:54 PDT 2012
Author: rsmith
Date: Thu Jun 7 20:30:54 2012
New Revision: 158186
URL: http://llvm.org/viewvc/llvm-project?rev=158186&view=rev
Log:
Allow friend declarations of defaulted special member functions. Only
definitions of such members are prohibited, not mere declarations.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=158186&r1=158185&r2=158186&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jun 7 20:30:54 2012
@@ -2039,7 +2039,7 @@
<< New << getSpecialMember(OldMethod);
return true;
}
- } else if (OldMethod->isExplicitlyDefaulted()) {
+ } else if (OldMethod->isExplicitlyDefaulted() && !isFriend) {
Diag(NewMethod->getLocation(),
diag::err_definition_of_explicitly_defaulted_member)
<< getSpecialMember(OldMethod);
Modified: cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp?rev=158186&r1=158185&r2=158186&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp Thu Jun 7 20:30:54 2012
@@ -51,3 +51,9 @@
struct lit { constexpr lit() {} };
S<lit> s_lit; // ok
S<bar> s_bar; // ok
+
+struct Friends {
+ friend S<bar>::S();
+ friend S<bar>::S(const S&);
+ friend S<bar>::S(S&&);
+};
More information about the cfe-commits
mailing list