This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix for using explicit on a friend decl (of a ctor, still illegal)
- To: egcs-patches at cygnus dot com
- Subject: fix for using explicit on a friend decl (of a ctor, still illegal)
- From: Brendan Kehoe <brendan at cygnus dot com>
- Date: Mon, 26 Oct 1998 11:48:09 -0800 (PST)
- Reply-To: brendan at cygnus dot com (Brendan Kehoe)
This makes the compiler give an error when a user tries something like
class foo { public: foo(); };
class bar { public: friend explicit foo::foo(); };
(Already checked into egcs.)
B
1998-10-26 Brendan Kehoe <brendan@cygnus.com>
* decl.c (grokdeclarator): Disallow `explicit' in a friend declaration.
--- decl.c 1998/10/25 23:15:00 1.244
+++ decl.c 1998/10/26 19:38:48
@@ -9235,6 +9235,10 @@ grokdeclarator (declarator, declspecs, d
friendp = RIDBIT_SETP (RID_FRIEND, specbits);
RIDBIT_RESET (RID_FRIEND, specbits);
+ /* $7.1.2, Function specifiers */
+ if (friendp && explicitp)
+ error ("only declarations of constructors can be `explicit'");
+
if (RIDBIT_SETP (RID_MUTABLE, specbits))
{
if (decl_context == PARM)
--
Brendan Kehoe brendan@cygnus.com
Cygnus Solutions, Sunnyvale, CA +1 408 542 9600
Web page: http://www.zen.org/~brendan/