@@ -597,6 +597,7 @@ TEST(FunctionReflectionTest, BestTemplateFunctionMatch) {
597
597
template<class A> long get_size(A&);
598
598
template<class A> long get_size();
599
599
template<class A, class B> long get_size(A a, B b);
600
+ template<class A> long add_size(float a);
600
601
};
601
602
602
603
template<class A>
@@ -609,6 +610,11 @@ TEST(FunctionReflectionTest, BestTemplateFunctionMatch) {
609
610
return sizeof(A) + 1;
610
611
}
611
612
613
+ template<class A>
614
+ long MyTemplatedMethodClass::add_size(float a) {
615
+ return sizeof(A) + long(a);
616
+ }
617
+
612
618
template<class A, class B>
613
619
long MyTemplatedMethodClass::get_size(A a, B b) {
614
620
return sizeof(A) + sizeof(B);
@@ -626,21 +632,24 @@ TEST(FunctionReflectionTest, BestTemplateFunctionMatch) {
626
632
std::vector<Cpp::TemplateArgInfo> args0;
627
633
std::vector<Cpp::TemplateArgInfo> args1 = {C.IntTy .getAsOpaquePtr ()};
628
634
std::vector<Cpp::TemplateArgInfo> args2 = {C.CharTy .getAsOpaquePtr (), C.FloatTy .getAsOpaquePtr ()};
635
+ std::vector<Cpp::TemplateArgInfo> args3 = {C.FloatTy .getAsOpaquePtr ()};
629
636
630
637
std::vector<Cpp::TemplateArgInfo> explicit_args0;
631
638
std::vector<Cpp::TemplateArgInfo> explicit_args1 = {C.IntTy .getAsOpaquePtr ()};
632
-
633
639
634
640
Cpp::TCppFunction_t func1 = Cpp::BestTemplateFunctionMatch (candidates, explicit_args0, args1);
635
641
Cpp::TCppFunction_t func2 = Cpp::BestTemplateFunctionMatch (candidates, explicit_args1, args0);
636
642
Cpp::TCppFunction_t func3 = Cpp::BestTemplateFunctionMatch (candidates, explicit_args0, args2);
643
+ Cpp::TCppFunction_t func4 = Cpp::BestTemplateFunctionMatch (candidates, explicit_args1, args3);
637
644
638
645
EXPECT_EQ (Cpp::GetFunctionSignature (func1),
639
646
" template<> long MyTemplatedMethodClass::get_size<int>(int &)" );
640
647
EXPECT_EQ (Cpp::GetFunctionSignature (func2),
641
648
" template<> long MyTemplatedMethodClass::get_size<int>()" );
642
649
EXPECT_EQ (Cpp::GetFunctionSignature (func3),
643
650
" template<> long MyTemplatedMethodClass::get_size<char, float>(char a, float b)" );
651
+ EXPECT_EQ (Cpp::GetFunctionSignature (func4),
652
+ " template<> long MyTemplatedMethodClass::get_size<float>(float &)" );
644
653
}
645
654
646
655
TEST (FunctionReflectionTest, IsPublicMethod) {
0 commit comments