File tree Expand file tree Collapse file tree 4 files changed +13
-13
lines changed
src/Generator/Generators/CSharp Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,8 @@ public string VisitParameter(Parameter parameter)
3131 return $ "({ desugared . Visit ( typePrinter ) } ) { expression } ";
3232 var finalType = ( desugared . GetFinalPointee ( ) ?? desugared ) . Desugar ( ) ;
3333 if ( finalType . TryGetClass ( out var @class ) && @class . IsInterface )
34- {
35- string cast ;
36- if ( parameter . DefaultArgument . Declaration is Method method &&
37- method . IsConstructor && method . Namespace == @class . OriginalClass )
38- {
39- cast = string . Empty ;
40- }
41- else
42- {
43- cast = $ "({ @class . OriginalClass . Visit ( typePrinter ) } ) ";
44- }
45- return cast + expression ;
46- }
34+ return $@ "({ @class . Visit ( typePrinter ) } ) ({
35+ @class . OriginalClass . Visit ( typePrinter ) } ) { expression } " ;
4736 return expression ;
4837 }
4938
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ public void TestDefaultArguments()
342342 methodsWithDefaultValues. DefaultWithFreeConstantInNameSpace ( ) ;
343343 methodsWithDefaultValues. DefaultWithStdNumericLimits ( 10 , 5 ) ;
344344 methodsWithDefaultValues. DefaultWithSpecialization ( ) ;
345+ methodsWithDefaultValues. DefaultOverloadedImplicitCtor ( ) ;
345346 methodsWithDefaultValues. DefaultWithParamNamedSameAsMethod ( 5 ) ;
346347 }
347348 }
Original file line number Diff line number Diff line change @@ -822,6 +822,14 @@ void MethodsWithDefaultValues::defaultWithSpecialization(IndependentFields<int>
822822{
823823}
824824
825+ void MethodsWithDefaultValues::defaultOverloadedImplicitCtor (P p)
826+ {
827+ }
828+
829+ void MethodsWithDefaultValues::defaultOverloadedImplicitCtor (Qux q)
830+ {
831+ }
832+
825833int MethodsWithDefaultValues::DefaultWithParamNamedSameAsMethod (int DefaultWithParamNamedSameAsMethod, const Foo& defaultArg)
826834{
827835 return 1 ;
Original file line number Diff line number Diff line change @@ -483,6 +483,8 @@ class DLL_API MethodsWithDefaultValues : public Quux
483483 void defaultWithStdNumericLimits (double d = 1.0 , int i = std::numeric_limits<double >::infinity());
484484 void defaultWithParamRequiringRename (_ClassWithLeadingUnderscore* ptr = nullptr );
485485 void defaultWithSpecialization (IndependentFields<int > specialization = IndependentFields<int >());
486+ void defaultOverloadedImplicitCtor (P p);
487+ void defaultOverloadedImplicitCtor (Qux q = Qux());
486488 int DefaultWithParamNamedSameAsMethod (int DefaultWithParamNamedSameAsMethod, const Foo& defaultArg = Foo());
487489 int getA ();
488490private:
You can’t perform that action at this time.
0 commit comments