public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/61433 (ICE with -fcompare-debug)
@ 2014-06-27 21:40 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2014-06-27 21:40 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

dump_template_bindings tries to do tsubsting in order to print what 
dependent types used in the template signature actually resolve to.  But 
that doesn't work to well when we're in a clone context, where we don't 
have a reasonable DECL_LANG_SPECIFIC to work with.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: 61433.patch --]
[-- Type: text/x-patch, Size: 1415 bytes --]

commit 2b1389491f53fd7ecc9dfe90b55c1d48c4c4548a
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jun 27 16:19:47 2014 -0400

    	PR c++/61433
    	* error.c (dump_template_bindings): Don't tsubst in a clone.

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 27a167a..fa3bdc4 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -318,6 +318,11 @@ dump_template_bindings (cxx_pretty_printer *pp, tree parms, tree args,
   if (vec_safe_is_empty (typenames) || uses_template_parms (args))
     return;
 
+  /* Don't try to print typenames when we're processing a clone.  */
+  if (current_function_decl
+      && !DECL_LANG_SPECIFIC (current_function_decl))
+    return;
+
   FOR_EACH_VEC_SAFE_ELT (typenames, i, t)
     {
       if (need_semicolon)
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
new file mode 100644
index 0000000..a63b8a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
@@ -0,0 +1,23 @@
+// PR c++/61433
+// { dg-do compile { target c++11 } }
+// { dg-options "-O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra" }
+
+template <class T>
+struct A
+{
+  template <class V>
+  struct B
+  {
+    int MEM;
+  };
+};
+struct D {};
+struct C: public A<int>::B<D>
+{};
+template <class T, class U, class V>
+auto k(T t, U u, V v) -> decltype (t.U::template B<V>::MEM)
+{}
+int main()
+{
+  k( C(), A<int>(), D() );
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-27 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-27 21:40 C++ PATCH for c++/61433 (ICE with -fcompare-debug) Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).