In Sema's TryRefInitWithConversionFunction, suppress user conversions for the overload candidates.

Fixes an infinite recursion in overload resolution for rdar://8499524.
Many thanks to Doug!

llvm-svn: 115588
This commit is contained in:
Argyrios Kyrtzidis 2010-10-05 03:05:30 +00:00
parent 0077b22aa4
commit dfbdfbba8f
2 changed files with 5 additions and 3 deletions

View File

@ -2325,10 +2325,12 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
if (ConstructorTmpl)
S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
/*ExplicitArgs*/ 0,
&Initializer, 1, CandidateSet);
&Initializer, 1, CandidateSet,
/*SuppressUserConversions=*/true);
else
S.AddOverloadCandidate(Constructor, FoundDecl,
&Initializer, 1, CandidateSet);
&Initializer, 1, CandidateSet,
/*SuppressUserConversions=*/true);
}
}
}

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Base { }; // expected-note{{candidate is the implicit copy constructor}}
struct Base { };
struct Derived : Base { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
struct Unrelated { };
struct Derived2 : Base { };