r174050 - Added outer template parameter lists to friend type AST nodes.
Enea Zaffanella
zaffanella at cs.unipr.it
Wed Feb 6 11:11:25 PST 2013
On 02/06/2013 07:51 AM, Nick Lewycky wrote:
> On 5 February 2013 20:31, Nick Lewycky <nlewycky at google.com
> <mailto: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
Seems fine.
Thanks for fixing it,
Enea.
More information about the cfe-commits
mailing list