From: Argyrios Kyrtzidis Date: Tue, 5 Oct 2010 03:05:30 +0000 (+0000) Subject: In Sema's TryRefInitWithConversionFunction, suppress user conversions for the overloa... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b72db8977ed032d6425045d7e9d36e49d9b2d3f8;p=clang 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115588 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 1ffa70207a..6fd1d68dcd 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -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); } } } diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp index 099f91caf6..fee5f96c38 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp @@ -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 { };