r174050 - Added outer template parameter lists to friend type AST nodes.

Nick Lewycky nlewycky at google.com
Tue Feb 5 22:51:55 PST 2013


On 5 February 2013 20:31, Nick Lewycky <nlewycky at google.com> wrote:

> Hi Enea! This introduced a regression. I've attached an updated testcase
> to go into clang, but the affected code looks like:
>
>   template<typename T> class B;
>
>   template <typename T>
>   class A {
>     template<typename S> friend class B<S>::ty;
>   };
>   template <typename T> class B {
>     struct ty {};
>   };
>
>   void test() {
>     (void)sizeof(A<int>);
>   }
>
> you didn't update CheckFriendTypeDecl or any of its callers.
> CheckFriendTypeDecl does this:
>
>   // C++11 [class.friend]p3:
>   // A friend declaration that does not declare a function shall have one
>   // of the following forms:
>   // friend elaborated-type-specifier ;
>   // friend simple-type-specifier ;
>   // friend typename-specifier ;
>   if (getLangOpts().CPlusPlus11 && LocStart != FriendLoc)
>     Diag(FriendLoc, diag::err_friend_not_first_in_declaration) << T;
>
> what happens is that LocStart now starts at the "template" keyword while
> the FriendLoc is the "friend" keyword.
>
> I'm going to try fixing it tonight, but if I can't then I might have to
> revert it temporarily and please resubmit when you have this bug fixed.
>

I committed the fix in r174486. Please take a look, and let me know if you
have any review comments!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130205/45270391/attachment.html>


More information about the cfe-commits mailing list