diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2002-12-02 17:03:13 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2002-12-02 17:03:13 +0000 |
commit | 218e0eb6d392fa569352ec89b8b121dcfc840e7d (patch) | |
tree | ee1622515d386905b16fa0279bb645657b1b064f | |
parent | 513f31eb684407555e3600efee9707f7e94a3351 (diff) | |
download | gcc-218e0eb6d392fa569352ec89b8b121dcfc840e7d.zip gcc-218e0eb6d392fa569352ec89b8b121dcfc840e7d.tar.gz gcc-218e0eb6d392fa569352ec89b8b121dcfc840e7d.tar.bz2 |
DR 180
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/crash32.C | 2 |
4 files changed, 21 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da4f597..2ade3e3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f3ffbf1..1e26b0f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d87d1e..4f05e81 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash32.C b/gcc/testsuite/g++.old-deja/g++.pt/crash32.C index 68cf4df..af6ef5b 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash32.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash32.C @@ -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 }; |