Topic: struct hack


Author: kearns@softrue.UUCP (Steven Kearns)
Date: 23 Feb 91 04:09:37 GMT
Raw View
According to ARM 9.1, p. 166:

a name can be declared as a class and as an (object, function, or
enumerator) in the same scope.  According to ARM 3.2, p. 16, the
(object, function, or enumerator) interpretation is the active one
for the name in that scope, but the class with the same name can still
be referred to by writing "class <name>".

All this is fine;  however, on p. 167, a comment indicates that
after the following declarations:

class X {
   X(int);
};
void X(int);

then a call such as "X(1);" would be ambiguous.  This sounds pretty wrong
to me.  According to the rules, X should be interpreted as the function
name, and thus "X(1)" calls the "void X(int);" function.  There is
no way to call the X(int) constructor; even "X::X(1)" does not work because
the first X is interpreted as the function name.

Comments?


********************************************************
* Steven Kearns            ....uunet!softrue!kearns    *
* Software Truth           softrue!kearns@uunet.uu.net *
********************************************************