Topic: more on local type names
Author: kearns@softrue.UUCP (Steven Kearns)
Date: 23 Feb 91 04:59:54 GMT Raw View
A follow on to the example in ARM 9.9, p. 190:
The example states that in:
typedef int c;
class X {
int f() { return sizeof(c); }
char c;
};
that the "char c" declaration is in error because c was used in the inline
of f().
However, the inline of f() should not be "interpreted" until the
whole of class X has been seen, so semantically, c is not "used"
until the end of class X and thus "char c" is fine. It is true that
lexically speaking, f() seems to "use" c before the "char c;".
However, the important thing is how the "sizeof(c)" would be
interpreted, and clearly at the end of class X c refers to "char c".
As a result, it seems clear to me that "c" should not be considered
used if it appears in an inline fuction def.
This confusion is just a symptom of the underlying disease caused by
this cankerous rule :-}.
********************************************************
* Steven Kearns ....uunet!softrue!kearns *
* Software Truth softrue!kearns@uunet.uu.net *
********************************************************