aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/dwarf2out.cc3
-rw-r--r--gcc/testsuite/g++.dg/debug/pr110295.C19
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index d89ffa6..e70c47c 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -26533,7 +26533,8 @@ process_scope_var (tree stmt, tree decl, tree origin, dw_die_ref context_die)
if (die != NULL && die->die_parent == NULL)
add_child_die (context_die, die);
- else if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
+
+ if (TREE_CODE (decl_or_origin) == IMPORTED_DECL)
{
if (early_dwarf)
dwarf2out_imported_module_or_decl_1 (decl_or_origin, DECL_NAME (decl_or_origin),
diff --git a/gcc/testsuite/g++.dg/debug/pr110295.C b/gcc/testsuite/g++.dg/debug/pr110295.C
new file mode 100644
index 0000000..10cad55
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/pr110295.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-g" }
+
+template <typename T>
+struct QCachedT
+{
+ void operator delete(void *, T *) {}
+};
+template<int a>
+void exercise()
+{
+ struct thing_t
+ : QCachedT<thing_t>
+ {
+ };
+ thing_t *list[1];
+ new thing_t; // { dg-warning "" }
+}
+int main() { exercise<1>(); }