Hi! I'm afraid this patch is incorrect; it even does the wrong thing in your test case. Skipping the setInstantiatedFromMemberTemplate call causes us to mix up the template parameter list numbering -- we substitute the argument given for T as the value U, and we don't substitute anything for T. For instance, in the definition of f instantiated for the f(3.0) call, we should have T=double, U=int, but we actually have T=<no value>, U=double, as can be seen in the AST dump.
This also does the wrong thing if C is instantiated twice -- such a case should be an error, because f would have multiple definitions. On Mon, Mar 24, 2014 at 5:29 AM, suyog sarda <[email protected]> wrote: > Gentle Ping!! > > > On Thu, Mar 20, 2014 at 9:46 AM, suyog sarda <[email protected]> wrote: > >> Gentle Ping!! >> >> >> On Fri, Mar 14, 2014 at 10:29 PM, suyog sarda <[email protected]>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);template <class U>class C{ template >>> <class T> friend void f(T) { C<U> c; c.i = 3; } public : >>> void g() { f(3.0); // OK } int i;};void h (){ f(7); // >>> OK 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 > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
