[PATCH] PR19095 Undefined reference to friend template function defined inside template class

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 3 08:23:28 PDT 2014


needs a testcase in the patch.

Richard is probably the best person to review template instantiations patches.



On 7 April 2014 10:15, suyog sarda <sardask01 at gmail.com> wrote:
> Gentle Ping. Please help in reviewing this patch.
>
>
> On Fri, Apr 4, 2014 at 9:56 PM, suyog sarda <sardask01 at gmail.com> wrote:
>>
>> Gentle Ping !! Please help in reviewing this small patch. Its a humble
>> request :)
>>
>>
>> On Tue, Apr 1, 2014 at 10:25 PM, suyog sarda <sardask01 at gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> Attaching patch for bug 19095. Please help in reviewing the same.
>>>
>>> Also, I haven't attached a test case yet in the patch as i am not sure
>>> how it should be and in which file it should be.
>>>
>>> In my opinion, the test case would go into
>>> tools/clang/test/SemaCXX/friend.cpp would be something like below (similar
>>> to that mentioned in the bug)
>>>
>>> template <class T>
>>> void f(T);
>>> void h(T);
>>>
>>> template <class U>
>>> class C
>>> {
>>>   template <class T>
>>>   friend void f(T)
>>>   {
>>>      int x = 1;
>>>   }
>>>  template <class T>
>>>   friend void h(T);
>>>
>>>   public :
>>>
>>>      void g()
>>>      {
>>>        f(3.0); // OK
>>>        h(2.0); // error : undefined reference to function h
>>>      }
>>>     int i;
>>> };
>>>
>>> void h ()
>>> {
>>>   f(7); // OK
>>>   h(6); // error : undefined reference to function h
>>>   C<double> c;
>>>   c.g();
>>> }
>>>
>>> Please help in reviewing the patch as well as the test case.
>>>
>>>
>>> --
>>> With regards,
>>> Suyog Sarda
>>
>>
>>
>>
>> --
>> With regards,
>> Suyog Sarda
>
>
>
>
> --
> With regards,
> Suyog Sarda
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list