Title
Can virtual appear in a friend declaration?
Status
cd1
Section
9.2.3 [dcl.fct.spec]
Submitter
Daveed Vandevoorde

Created on 2004-09-23.00:00:00 last changed 196 months ago

Messages

Date: 2006-10-15.00:00:00

[Voted into WP at the October, 2006 meeting.]

Date: 2005-10-15.00:00:00

Proposed resolution (October, 2005):

Change 9.2.3 [dcl.fct.spec] paragraphs 5-6 as indicated:

The virtual specifier shall only be used only in declarations the initial declaration of a non-static class member functions that appear within a member-specification of a class definition function; see 11.7.3 [class.virtual].

The explicit specifier shall be used only in declarations the declaration of constructors a constructor within a its class definition; see 11.4.8.2 [class.conv.ctor].

Date: 2004-09-23.00:00:00

I couldn't find wording that makes it invalid to say friend virtual... The closest seems to be 9.2.3 [dcl.fct.spec] paragraph 5, which says:

The virtual specifier shall only be used in declarations of nonstatic class member functions that appear within a member-specification of a class definition; see 11.7.3 [class.virtual].

I don't think that excludes a friend declaration (which is a valid member-specification by 11.4 [class.mem]).

John Spicer: I agree that virtual should not be allowed on friend declarations. I think the wording in 9.2.3 [dcl.fct.spec] is intended to be the declaration of a function within its class, although I think the wording should be improved to make it clearer.

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2007-05-06 00:00:00adminsetstatus: dr -> wp
2006-11-05 00:00:00adminsetmessages: + msg1434
2006-11-05 00:00:00adminsetstatus: ready -> dr
2006-04-22 00:00:00adminsetstatus: review -> ready
2005-10-22 00:00:00adminsetmessages: + msg1235
2005-10-22 00:00:00adminsetstatus: drafting -> review
2005-05-01 00:00:00adminsetstatus: open -> drafting
2004-09-23 00:00:00admincreate