diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2014-01-29 20:54:09 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2014-01-29 20:54:09 +0000 |
commit | 1200933cccdd1bbab4758560f36809f46434294a (patch) | |
tree | 43560713e5a7f2a35f9db15893e66276d46a3fd1 | |
parent | 7651c656858e4c80febb67e1742c0aa0d716e1a1 (diff) | |
download | gcc-1200933cccdd1bbab4758560f36809f46434294a.zip gcc-1200933cccdd1bbab4758560f36809f46434294a.tar.gz gcc-1200933cccdd1bbab4758560f36809f46434294a.tar.bz2 |
re PR c++/58561 ([c++11] ICE using declaration of function with auto in return type)
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58561
* dwarf2out.c (is_cxx_auto): New.
(is_base_type): Use it.
(gen_type_die_with_usage): Likewise.
/testsuite
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58561
* g++.dg/cpp1y/auto-fn23.C: New.
From-SVN: r207282
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 41 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/auto-fn23.C | 9 |
4 files changed, 47 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5f662b..71fd8e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-01-29 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58561 + * dwarf2out.c (is_cxx_auto): New. + (is_base_type): Use it. + (gen_type_die_with_usage): Likewise. + 2014-01-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Use diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index f6efd1f..d1ca4ba 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10219,6 +10219,23 @@ base_type_die (tree type) return base_type_result; } +/* A C++ function with deduced return type can have a TEMPLATE_TYPE_PARM + named 'auto' in its type: return true for it, false otherwise. */ + +static inline bool +is_cxx_auto (tree type) +{ + if (is_cxx ()) + { + tree name = TYPE_NAME (type); + if (TREE_CODE (name) == TYPE_DECL) + name = DECL_NAME (name); + if (name == get_identifier ("auto")) + return true; + } + return false; +} + /* Given a pointer to an arbitrary ..._TYPE tree node, return nonzero if the given input type is a Dwarf "fundamental" type. Otherwise return null. */ @@ -10252,6 +10269,8 @@ is_base_type (tree type) return 0; default: + if (is_cxx_auto (type)) + return 0; gcc_unreachable (); } @@ -19830,24 +19849,16 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, break; default: - // A C++ function with deduced return type can have - // a TEMPLATE_TYPE_PARM named 'auto' in its type. - if (is_cxx ()) + if (is_cxx_auto (type)) { - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - if (name == get_identifier ("auto")) + if (!auto_die) { - if (!auto_die) - { - auto_die = new_die (DW_TAG_unspecified_type, - comp_unit_die (), NULL_TREE); - add_name_attribute (auto_die, "auto"); - } - equate_type_number_to_die (type, auto_die); - break; + auto_die = new_die (DW_TAG_unspecified_type, + comp_unit_die (), NULL_TREE); + add_name_attribute (auto_die, "auto"); } + equate_type_number_to_die (type, auto_die); + break; } gcc_unreachable (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e108609..62bcc31 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2014-01-29 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/58561 + * g++.dg/cpp1y/auto-fn23.C: New. + +2014-01-29 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/58846 * g++.dg/init/dso_handle2.C: New. diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C new file mode 100644 index 0000000..57503d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C @@ -0,0 +1,9 @@ +// PR c++/58561 +// { dg-options "-std=c++1y -g" } + +auto foo(); + +namespace N +{ + using ::foo; +} |