Hello,
This is a re-posting of the patch I had posted 2 weeks back. I could
locate a PR for it, hence I am posting it now with the PR annotations.
Though the bug is in the 'debug' component, because of the nature of
the fix, I think it should be treated as a bug in the 'c++' component.
The patch is attached.
Link to the previous posting:
http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00587.html
ChangeLog:
2014-03-25 Siva Chandra Reddy <[email protected]>
Fix PR debug/57519
/cp
PR debug/57519
* class.c (handle_using_decl): Pass the correct scope to
cp_emit_debug_info_for_using.
testsuite/
PR debug/57519
* g++.dg/debug/dwarf2/imported-decl-2.C: New testcase.
Thanks,
Siva Chandra
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b46391b..6ad82d7 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1299,7 +1299,7 @@ handle_using_decl (tree using_decl, tree t)
old_value = NULL_TREE;
}
- cp_emit_debug_info_for_using (decl, USING_DECL_SCOPE (using_decl));
+ cp_emit_debug_info_for_using (decl, t);
if (is_overloaded_fn (decl))
flist = decl;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
new file mode 100644
index 0000000..70200ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -O0 -fno-merge-debug-strings" }
+
+class AAAA
+{
+ public:
+ int method (void);
+ int a;
+};
+
+int
+AAAA::method (void)
+{
+ return a;
+}
+
+class BBBB : public AAAA
+{
+ public:
+ using AAAA::method;
+
+ int method (int b);
+};
+
+int
+BBBB::method (int b)
+{
+ return a + b;
+}
+
+// { dg-final { scan-assembler-not "ascii \"BBBB\\\\0\".*ascii
\"AAAA\\\\0\".*DW_TAG_imported_declaration" } }
+// { dg-final { scan-assembler-times "ascii \"AAAA\\\\0\".*ascii
\"BBBB\\\\0\".*DW_TAG_imported_declaration" 1 } }