aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/cp-gimplify.cc2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr108716.C14
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 32fe535..921b0e4 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -1530,6 +1530,8 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
tree using_directive = make_node (IMPORTED_DECL);
TREE_TYPE (using_directive) = void_type_node;
DECL_CONTEXT (using_directive) = current_function_decl;
+ DECL_SOURCE_LOCATION (using_directive)
+ = cp_expr_loc_or_input_loc (stmt);
IMPORTED_DECL_ASSOCIATED_DECL (using_directive) = decl;
DECL_CHAIN (using_directive) = BLOCK_VARS (block);
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr108716.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr108716.C
new file mode 100644
index 0000000..59ed524
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr108716.C
@@ -0,0 +1,14 @@
+// PR debug/108716
+// { dg-options "-O0 -gdwarf-5 -dA -fno-merge-debug-strings" }
+// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]*0xc\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*(\[^\n\r\]*0x13\[^\n\r\]* DW_AT_decl_column\[^\n\r\]*\[\n\r]*)?" } }
+
+namespace M {
+ int x = 1;
+}
+
+int
+main ()
+{
+ using namespace M;
+ return 0;
+}