Message ID | 52E8229D.8010502@oracle.com |
---|---|
State | New |
Headers | show |
On 01/28/2014 04:35 PM, Paolo Carlini wrote: > + if (is_cxx ()) > + { > + tree name = TYPE_NAME (type); > + if (TREE_CODE (name) == TYPE_DECL) > + name = DECL_NAME (name); > + if (name == get_identifier ("auto")) > + return 0; Rather than duplicate this code, let's factor it out into a separate function. Also, your ChangeLog has nothing to do with the patch. :) Jason
On 01/29/2014 05:42 PM, Jason Merrill wrote: > On 01/28/2014 04:35 PM, Paolo Carlini wrote: >> + if (is_cxx ()) >> + { >> + tree name = TYPE_NAME (type); >> + if (TREE_CODE (name) == TYPE_DECL) >> + name = DECL_NAME (name); >> + if (name == get_identifier ("auto")) >> + return 0; > > Rather than duplicate this code, let's factor it out into a separate > function. Yeah, you are totally right, we have at least 3/4 uses of that. Care to propose a name? > Also, your ChangeLog has nothing to do with the patch. :) :) I attached 58581 instead of 58561. Paolo.
On 01/29/2014 11:48 AM, Paolo Carlini wrote: >> Rather than duplicate this code, let's factor it out into a separate >> function. > Yeah, you are totally right, we have at least 3/4 uses of that. Care to > propose a name? is_cxx_auto? Jason
Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 207199) +++ dwarf2out.c (working copy) @@ -10252,6 +10252,16 @@ is_base_type (tree type) return 0; default: + // A C++ function with deduced return type can have + // a TEMPLATE_TYPE_PARM named 'auto' in its 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 0; + } gcc_unreachable (); } Index: testsuite/g++.dg/cpp1y/auto-fn23.C =================================================================== --- testsuite/g++.dg/cpp1y/auto-fn23.C (revision 0) +++ testsuite/g++.dg/cpp1y/auto-fn23.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/58561 +// { dg-options "-std=c++1y -g" } + +auto foo(); + +namespace N +{ + using ::foo; +}