Hi,
here we ICE exactly as we did in c++/53756: the only difference is the
use of decltype(auto) instead of auto. Now, if we compare is_cxx_auto to
is_auto (the front-end helper), evidently there is an inconsistency
about the handling of decltype(auto) and the below fixes the ICE.
However, also clearly the patchlet needs a review, because an out of
class decltype(auto) is already fine. Also, I'm not 100% sure we don't
need a decltype_auto_die, etc.
Tested x86_64-linux.
Thanks,
Paolo.
///////////////////////
2014-02-25 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/60314
* dwarf2out.c (is_cxx_auto): Handle decltype(auto).
/testsuite
2014-02-25 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/60314
* g++.dg/cpp1y/auto-fn24.C: New.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 208113)
+++ dwarf2out.c (working copy)
@@ -10230,7 +10230,8 @@ is_cxx_auto (tree type)
tree name = TYPE_NAME (type);
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
- if (name == get_identifier ("auto"))
+ if (name == get_identifier ("auto")
+ || name == get_identifier ("decltype(auto)"))
return true;
}
return false;
Index: testsuite/g++.dg/cpp1y/auto-fn24.C
===================================================================
--- testsuite/g++.dg/cpp1y/auto-fn24.C (revision 0)
+++ testsuite/g++.dg/cpp1y/auto-fn24.C (working copy)
@@ -0,0 +1,12 @@
+// PR c++/60314
+// { dg-options "-std=c++1y -g" }
+
+// fine
+decltype(auto) qux() { return 42; }
+
+struct foo
+{
+ // also ICEs if not static
+ static decltype(auto) bar()
+ { return 42; }
+};