diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 00:21:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 00:21:20 +0000 |
commit | 0d6d12b2db47ff34d6cd30917992a8c8ad97aac2 (patch) | |
tree | b28e68e577d9001bdc336713413c6f1bf073b432 /lib/Sema/SemaOverload.cpp | |
parent | d6d37dee48cfc5bbcc998bd9d151e4fb3a9437e8 (diff) |
When converting from a type to itself or one of its base classes via a
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index fbcb807428..66aa4845b1 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -451,7 +451,8 @@ Sema::TryImplicitConversion(Expr* From, QualType ToType, QualType FromCanon = Context.getCanonicalType(From->getType().getUnqualifiedType()); QualType ToCanon = Context.getCanonicalType(ToType).getUnqualifiedType(); - if (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon)) { + if (Constructor->isCopyConstructor(Context) && + (FromCanon == ToCanon || IsDerivedFrom(FromCanon, ToCanon))) { // Turn this into a "standard" conversion sequence, so that it // gets ranked with standard conversion sequences. ICS.ConversionKind = ImplicitConversionSequence::StandardConversion; |