------- Comment #7 from jakub at gcc dot gnu dot org  2009-03-17 08:52 -------
Created an attachment (id=17472)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17472&action=view)
gcc44-local-imported-decl.patch

Incremental patch to emit DW_TAG_imported_declaration DIEs (other than
namespace aliases) in the right lexical blocks.

Possible testcase for gdb:
namespace A
{
  int i = 1;
  int j = 2;
}

namespace B
{
  int k = 3;
}

int k = 13;

void
foo ()
{
  using namespace A;
  i++;
  j++;
  k++;
  {
    using B::k;
    k++;
  }
}

template <int N>
void
bar ()
{
  using namespace A;
  i++;
  j++;
  k++;
  {
    using B::k;
    k++;
  }
}

int
main ()
{
  foo ();
  bar<0> ();
  bar<6> ();
}

Concerning:
"We won't be going through the USING_STMT code path in case of We won't be
going through the USING_STMT code path in case of namespace aliases, sorry. My
last comment was irrelevant."
we really should be going through USING_STMT or something similar for namespace
aliases as well, see PR37890.  Given that namespace aliases are just emitted
using gen_namespace_die, perhaps just adding the NAMESPACE_DECL to BLOCK_VARS
would be sufficient.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39471

Reply via email to