mangle.c (write_type): Handle 'auto'.

gcc/cp/
	* mangle.c (write_type): Handle 'auto'.
	* init.c (build_new): Don't do auto deduction where it might
	affect template mangling.
libiberty/
	* cp-demangle.c (cplus_demangle_type): Handle 'auto'.

From-SVN: r185606
This commit is contained in:
Jason Merrill 2012-03-21 10:43:00 -04:00 committed by Jason Merrill
parent 22b515f1b6
commit 94dd0b741a
8 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2012-03-20 Jason Merrill <jason@redhat.com>
* mangle.c (write_type): Handle 'auto'.
* init.c (build_new): Don't do auto deduction where it might
affect template mangling.
2012-03-07 Jason Merrill <jason@redhat.com>
PR c++/52521

View File

@ -2768,7 +2768,9 @@ build_new (VEC(tree,gc) **placement, tree type, tree nelts,
if (type == error_mark_node)
return error_mark_node;
if (nelts == NULL_TREE && VEC_length (tree, *init) == 1)
if (nelts == NULL_TREE && VEC_length (tree, *init) == 1
/* Don't do auto deduction where it might affect mangling. */
&& (!processing_template_decl || at_function_scope_p ()))
{
tree auto_node = type_uses_auto (type);
if (auto_node)

View File

@ -1933,6 +1933,13 @@ write_type (tree type)
break;
case TEMPLATE_TYPE_PARM:
if (is_auto (type))
{
write_identifier ("Da");
++is_builtin_type;
break;
}
/* else fall through. */
case TEMPLATE_PARM_INDEX:
write_template_param (type);
break;

View File

@ -1,3 +1,7 @@
2012-03-20 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/auto32.C: New.
2012-03-15 Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <apinski@cavium.com>

View File

@ -0,0 +1,9 @@
// { dg-do compile { target c++11 } }
// { dg-final { scan-assembler "_Z1fIiEDTnw_Dapifp_EET_" } }
template <class T> auto f(T t) -> decltype (new auto(t));
int main()
{
f(1);
}

View File

@ -1,3 +1,7 @@
2012-03-20 Jason Merrill <jason@redhat.com>
* cp-demangle.c (cplus_demangle_type): Handle 'auto'.
2012-01-26 Jakub Jelinek <jakub@redhat.com>
* make-relative-prefix.c (make_relative_prefix_1): Avoid warning

View File

@ -2264,6 +2264,11 @@ cplus_demangle_type (struct d_info *di)
cplus_demangle_type (di), NULL);
can_subst = 1;
break;
case 'a':
/* auto */
ret = d_make_name (di, "auto", 4);
break;
case 'f':
/* 32-bit decimal floating point */

View File

@ -4072,6 +4072,12 @@ decltype (g({parm#1}, {})) f1<int>(int)
--format=gnu-v3
_Z2f1IiEDTnw_T_ilEES0_
decltype (new int{}) f1<int>(int)
--format=gnu-v3
_Z1fIiEDTnw_Dapifp_EET_
decltype (new auto({parm#1})) f<int>(int)
--format=gnu-v3
_Z1fIiERDaRKT_S1_
auto& f<int>(int const&, int)
#
# Ada (GNAT) tests.
#