DR 180
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Mon, 2 Dec 2002 17:03:13 +0000 (17:03 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Mon, 2 Dec 2002 17:03:13 +0000 (17:03 +0000)
DR 180
* decl.c (grokdeclarator): Require class-key for all friend class.
Output the correct type and context in the error message.

* g++.old-deja/g++.pt/crash32.C: Expect error.

From-SVN: r59719

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/crash32.C

index da4f5977ddaee3f27ad71f188cb80f70a8bc273d..2ade3e38382d9bd99138f05c521a673f46129509 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-02  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       DR 180
+       * decl.c (grokdeclarator): Require class-key for all friend class.
+       Output the correct type and context in the error message.
+
 2002-12-01  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5919
index f3ffbf10712a228dd13b22e9e56672005ae0b77e..1e26b0f112cdd25a822d1c9d107d03e4d18e06dc 100644 (file)
@@ -11645,22 +11645,19 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
              inlinep = 0;
            }
 
-         /* Until core issue 180 is resolved, allow 'friend typename A::B'.
-            But don't allow implicit typenames except with a class-key.  */
-         if (!current_aggr && (TREE_CODE (type) != TYPENAME_TYPE
-                               || IMPLICIT_TYPENAME_P (type)))
+         if (!current_aggr)
            {
+             /* Don't allow friend declaration without a class-key.  */
              if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
-               pedwarn ("template parameters cannot be friends");
+               pedwarn ("template parameters cannot be friends");
              else if (TREE_CODE (type) == TYPENAME_TYPE)
-               pedwarn ("\
-friend declaration requires class-key, i.e. `friend class %T::%T'",
-                           constructor_name (current_class_type),
-                           TYPE_IDENTIFIER (type));
+               pedwarn ("friend declaration requires class-key, "
+                        "i.e. `friend class %T::%D'",
+                        TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type));
              else
-               pedwarn ("\
-friend declaration requires class-key, i.e. `friend %#T'",
-                           type);
+               pedwarn ("friend declaration requires class-key, "
+                        "i.e. `friend %#T'",
+                        type);
            }
 
          /* Only try to do this stuff if we didn't already give up.  */
index 0d87d1ec168407a7067c2906a6576c78bd39a8f4..4f05e81e694e134ca1adffa2a071c5fd25a750b0 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-02  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       DR 180
+       * g++.old-deja/g++.pt/crash32.C: Expect error.
+
 2002-12-01  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/5919
index 68cf4df6fb220ba0a5b6dfc122a578e39ac47b9f..af6ef5b95cd36560a0f031971de1e845d1a18902 100644 (file)
@@ -8,6 +8,6 @@ template <class T> struct A
 
 template<class T> struct C
 {
-  friend typename A<T>::B;
+  friend typename A<T>::B; // ERROR - struct is required
 };