Title
Visibility of called function
Status
cd1
Section
7.6.1.3 [expr.call]
Submitter
Christophe de Dinechin

Created on 1999-05-05.00:00:00 last changed 161 months ago

Messages

Date: 2001-10-15.00:00:00

[Moved to DR at 10/01 meeting.]

Date: 2004-09-10.00:00:00

Christophe de Dinechin: In 7.6.1.3 [expr.call] , paragraph 2 reads:

If no declaration of the called function is visible from the scope of the call the program is ill-formed.
I think nothing there or in the previous paragraph indicates that this does not apply to calls through pointer or virtual calls.

Mike Miller: "The called function" is unfortunate phraseology; it makes it sound as if it's referring to the function actually called, as opposed to the identifier in the postfix expression. It's wrong with respect to Koenig lookup, too (the declaration need not be visible if it can be found in a class or namespace associated with one or more of the arguments).

In fact, this paragraph should be a note. There's a general rule that says you have to find an unambiguous declaration of any name that is used (6.5 [basic.lookup] paragraph 1); the only reason this paragraph is here is to contrast with C's implicit declaration of called functions.

Proposed resolution:

Change section 7.6.1.3 [expr.call] paragraph 2 from:
If no declaration of the called function is visible from the scope of the call the program is ill-formed.
to:
[Note: if a function or member function name is used, and name lookup (6.5 [basic.lookup]) does not find a declaration of that name, the program is ill-formed. No function is implicitly declared by such a call. ]

(See also issue 218.)

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetstatus: dr -> wp
2002-05-10 00:00:00adminsetmessages: + msg666
2001-11-09 00:00:00adminsetstatus: ready -> dr
2001-05-20 00:00:00adminsetstatus: review -> ready
2000-05-21 00:00:00adminsetstatus: drafting -> review
2000-02-23 00:00:00adminsetstatus: open -> drafting
1999-05-05 00:00:00admincreate