[comp.lang.c++] Bug bug? solved

wim@targon.UUCP (Wim C. J. van Eerdt) (12/08/87)

As long as the department does not have an uucp-feed,
you can e-mail me, the poster.
Success!

	Wim van Eerdt                   E-mail: mcvax!targon!wim
	OSP, Nixdorf Computer Bv, Postbus 29, 4130 EA Vianen
	Nederland. Tel.: +31 3473 62211.

----------------News article got:-------------------------------------
Author: Gerard van Dorth
Subject:  Bug bug? solved (?)
Keywords: inline local variables

> ... Redeclaration of "_au2__Xt_val_global"

The conditional statement on the lines 161/162 "if ( base == BLOCK  &&
	n->lex_level < ( (Pfct(expand_fn->tp)->memof) ? 3 : 2 ) )"
in file expand.c has to be changed in:
"if (  base == BLOCK && n->lex_level < 'function-defined-in-class' ? 3 : 2  )".

For a function defined in a class the lex_level is raised by the curly brace
of the class itself. Not only member functions (memof = member of) can be
defined inline, friends can also.
(Note that funny declarations of local variables did appear in case a member
function which needs locals is declared inline but not defined in the class
itself).

The most simple way to tell whether a function is defined in a class is the
use of a global variable (the more globals the more fun), set and reset 
(embracing the first loop) in the routine classdef::simpl() in file simpl.c
-- 
	Wim van Eerdt                   E-mail: mcvax!targon!wim
	OSP, Nixdorf Computer Bv, Postbus 29, 4130 EA Vianen
	Nederland. Tel.: +31 3473 62211.