diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-04-12 17:16:29 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-04-12 17:16:29 +0000 |
commit | 42e92c4bc3e11d4dce0aa01f0949a4a7dadeeb7a (patch) | |
tree | 83a6bdfa6d3707d0ce02ea5655d1e5378ed1771f /clang/lib/Sema/SemaExprCXX.cpp | |
parent | e4bd8904f7020af2e392dddb0ab2de048678aeab (diff) | |
download | bcm5719-llvm-42e92c4bc3e11d4dce0aa01f0949a4a7dadeeb7a.tar.gz bcm5719-llvm-42e92c4bc3e11d4dce0aa01f0949a4a7dadeeb7a.zip |
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.
llvm-svn: 68902
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 4a5bfd59ae5..e2a21f842df 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -737,13 +737,23 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) { /// 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); } |