diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-01 03:43:00 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-01 03:43:00 +0000 |
commit | 4712c02c1550a72612c07f5aaee455dcd8273b96 (patch) | |
tree | 42cde706764ccbf43a275254513448c36cbe893b /lib/Sema/SemaInit.cpp | |
parent | 4b662a5684d41ea4ff6b52711929e00fefb00db1 (diff) |
When performing copy initialization via user-defined conversions,
don't allow two user-defined conversions. Fixes PR6595 (again).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index c2d6de749b..3acec56670 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -2858,7 +2858,6 @@ static void TryUserDefinedConversion(Sema &S, Con != ConEnd; ++Con) { NamedDecl *D = *Con; DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess()); - bool SuppressUserConversions = false; // Find the constructor (which may be a template). CXXConstructorDecl *Constructor = 0; @@ -2867,17 +2866,8 @@ static void TryUserDefinedConversion(Sema &S, if (ConstructorTmpl) Constructor = cast<CXXConstructorDecl>( ConstructorTmpl->getTemplatedDecl()); - else { + else Constructor = cast<CXXConstructorDecl>(D); - - // If we're performing copy initialization using a copy constructor, - // we suppress user-defined conversions on the arguments. - // FIXME: Move constructors? - if (Kind.getKind() == InitializationKind::IK_Copy && - Constructor->isCopyConstructor()) - SuppressUserConversions = true; - - } if (!Constructor->isInvalidDecl() && Constructor->isConvertingConstructor(AllowExplicit)) { @@ -2885,11 +2875,11 @@ static void TryUserDefinedConversion(Sema &S, S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl, /*ExplicitArgs*/ 0, &Initializer, 1, CandidateSet, - SuppressUserConversions); + /*SuppressUserConversions=*/true); else S.AddOverloadCandidate(Constructor, FoundDecl, &Initializer, 1, CandidateSet, - SuppressUserConversions); + /*SuppressUserConversions=*/true); } } } |