Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously.
Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now.
The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68902 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 4a5bfd5..e2a21f8 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -737,13 +737,23 @@
/// error, false otherwise. The expression From is replaced with the
/// converted expression. Flavor is the kind of conversion we're
/// performing, used in the error message. If @p AllowExplicit,
-/// explicit user-defined conversions are permitted.
-bool
+/// explicit user-defined conversions are permitted. @p Elidable should be true
+/// when called for copies which may be elided (C++ 12.8p15). C++0x overload
+/// resolution works differently in that case.
+bool
Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
- const char *Flavor, bool AllowExplicit)
+ const char *Flavor, bool AllowExplicit,
+ bool Elidable)
{
- ImplicitConversionSequence ICS = TryImplicitConversion(From, ToType, false,
- AllowExplicit);
+ ImplicitConversionSequence ICS;
+ ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
+ if (Elidable && getLangOptions().CPlusPlus0x) {
+ ICS = TryImplicitConversion(From, ToType, /*SuppressUserConversions*/false,
+ AllowExplicit, /*ForceRValue*/true);
+ }
+ if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
+ ICS = TryImplicitConversion(From, ToType, false, AllowExplicit);
+ }
return PerformImplicitConversion(From, ToType, ICS, Flavor);
}