diff mbox

[C++] PR 50344

Message ID 4E7A29CD.8030101@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 21, 2011, 6:15 p.m. UTC
On 09/21/2011 06:55 PM, Jason Merrill wrote:
> I think we do.
Agreed. I'm finishing testing the below, Ok if it passes?

Thanks,
Paolo.

//////////////////////////
/cp
2011-09-21  Jonathan Wakely  <jwakely.gcc@gmail.com>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50344
	* friend.c (make_friend_class): cv-qualification is ok in a
	friend declaration.

/testsuite
2011-09-21  Jonathan Wakely  <jwakely.gcc@gmail.com>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50344
	* g++.dg/template/friend52.C: New.

Comments

Jason Merrill Sept. 22, 2011, 1:31 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: testsuite/g++.dg/template/friend52.C
===================================================================
--- testsuite/g++.dg/template/friend52.C	(revision 0)
+++ testsuite/g++.dg/template/friend52.C	(revision 0)
@@ -0,0 +1,17 @@ 
+// PR c++/50344
+// { dg-options "" }
+
+template <typename T> class C
+{
+   friend T;
+   int i;
+};
+
+struct S
+{
+    int f()
+    {
+       C<const S> c;
+       return c.i;
+    }
+};
Index: cp/friend.c
===================================================================
--- cp/friend.c	(revision 179052)
+++ cp/friend.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* Help friends in C++.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2007, 2008, 2010  Free Software Foundation, Inc.
+   2007, 2008, 2010, 2011  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -237,6 +237,8 @@  make_friend_class (tree type, tree friend_type, bo
       return;
     }
 
+  friend_type = cv_unqualified (friend_type);
+
   if (friend_depth)
     /* If the TYPE is a template then it makes sense for it to be
        friends with itself; this means that each instantiation is