]> granicus.if.org Git - clang/commitdiff
In Sema's TryRefInitWithConversionFunction, suppress user conversions for the overloa...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 5 Oct 2010 03:05:30 +0000 (03:05 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 5 Oct 2010 03:05:30 +0000 (03:05 +0000)
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

lib/Sema/SemaInit.cpp
test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp

index 1ffa70207ab06ebe8c1baf16f7b60e80267e312d..6fd1d68dcd06cd64853cd0d1cb6904e74803da4b 100644 (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);
       }
     }    
   }
index 099f91caf63d093ead18d3466a74d4d86eefc2af..fee5f96c389f36cdc7e78cf583e298c027ec138f 100644 (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 { };