Kenneth Zadeck wrote:

The kludge to handle them is documented in cp/name-lookup.c around line 670

Ugh.

IMO, the right thing here is that there should be only one FUNCTION_DECL for a given function, ever, period. Default arguments are not part of "the function" in C++; they are an aspect of particular declarations of the function. The problem we're having is that we associate them with the FUNCTION_DECL, rather than with the bindings (mappings from names to FUNCTION_DECLs).

Unfortunately, fixing that properly is a rather large change.

It seems like a better way is to build a table of merges that need to be done and find some place after the c++ front end is finished but before the cgraph gets built and do one scan of the code and replace all of the offending decls.

After the C++ front end is done, it would be OK to canoanicalize all FUNCTION_DECLs with a single UID into one. A stupid way of doing that would be to just walk the entire translation unit, and whenever you find a reference to a non-canonical copy of the FUNCTION_DECL, re-point it at the right one.

The C++ front end always operates in unit-at-a-time mode, so, yes, you could do this when the C++ front end is finished.

--
Mark Mitchell
CodeSourcery, LLC
[EMAIL PROTECTED]
(916) 791-8304

Reply via email to