Topic: Use of name - inline functions


Author: larsn@Autodesk.COM (Lars Nyman)
Date: 18 Jun 92 18:10:46 GMT
Raw View
ARM p178:
 "Defining a function within a class declaration is equivalent to
  declaring it inline and defining it immediately after the class
  declaration; this rewriting is considered to be done after
  preprocessing but before syntax analysis and type checking af the
  function definition."

ARM p189-190:
 "A class-name or a typedef-name or the name of a constant used in a
  type name may not be redefined in a class declaration after being
  used in the class declaration, ...".

What constitutes a "use" of a name ?
E.g., is usage of a name in an inline member function considered a "use" of
a name, or are inline functions rewritten according to the rewrite rule first
and thus the name will refer to the local name in the class declaration ?

The example in ARM (p190) seems to indicate that inline functions are NOT
rewritten first.

Consider the following:

 int a;
 typedef int b;
 struct x {

     size_t f() { return sizeof(a); }
     size_t g() { return sizeof(b); }

     char a;
     double b;
 };

If inline functions are not "rewritten" first, then the reference to b in
x::g() refers to ::b, while the referene to a in x::f() refers to x::a.
This seems to be somewhat "inconsistent".