This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [using-directive] Regression against FSF GDB
On Wed, 28 Jan 2009 22:26:44 +0100, Sami Wagiaalla wrote:
> Incidentally I have also looked at this:
>
> namespace A{
> int x;
> }
>
> namespace B{
> int x;
> }
>
> int main(){
> using namespace A;
> x; // This is okay [1]
> using namespace B;
> x; // This is illegal according to gcc [2]
> }
>
> The debug info is there and we have a choice of how to handle this in
> gdb. [1] can be handled by checking the current line number with the
> line number of the import that way we wont print B::x. Since [2] is
> illegal we can do whatever we want in gdb,
gcc-c++-4.3.2-7:
/tmp/illegal.C:13: error: reference to ‘x’ is ambiguous
/tmp/illegal.C:6: error: candidates are: int B::x
/tmp/illegal.C:2: error: int A::x
I do not agree there is any choice. Primarily Archer should follow how would a
C++ compiler behave. As the described source file can never produce a valid
binary output GDB should consider such found DWARF info as invalid and use:
complaint (&symfile_complaints, _("..."));
> raise an error or ask the user to choose.
And yes, even error()-out if the user requests to reference such variable.
But if I understand it correctly such case may never happen in practice as C++
will never produce such binary so I doubt it is a serious concern.
Regards,
Jan