summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-21 04:04:39 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-21 04:04:39 +0000
commit1610993e39e7c0db9b77a87f512229d4385168ba (patch)
treed78ec393143f330e334e0d1388fbcd7568ca8b93
parent26a72469f89b8955b19dc80bf4ce415903994d5c (diff)
downloadgcc-1610993e39e7c0db9b77a87f512229d4385168ba.tar.gz
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'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185595 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/mangle.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto32.C9
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libiberty/cp-demangle.c5
-rw-r--r--libiberty/testsuite/demangle-expected6
8 files changed, 42 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5fbf3f57a45..8dcc4462d04 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +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.
+
PR c++/52510
* decl.c (reshape_init_class): Handle repeated reshaping.
* search.c (lookup_field_1): Add sanity check.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 1b2a1ef15ae..bcb5ab7a23b 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2774,7 +2774,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)
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 5d6beb5d578..1536828a32c 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cca054e87f7..71f1fe7ed77 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-20 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/auto32.C: New.
+
2012-03-20 Georg-Johann Lay <avr@gjlay.de>
PR testsuite/52641
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto32.C b/gcc/testsuite/g++.dg/cpp0x/auto32.C
new file mode 100644
index 00000000000..2aad34e40ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto32.C
@@ -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);
+}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 97bdfed4cc6..add9ff9d1a7 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-20 Jason Merrill <jason@redhat.com>
+
+ * cp-demangle.c (cplus_demangle_type): Handle 'auto'.
+
2012-03-07 Jason Merrill <jason@redhat.com>
* cp-demangle.c (cplus_demangle_operators): Add li.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 2b3d1820c60..d95b56c71a9 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2270,6 +2270,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 */
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 036c4813513..d489692f0b6 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4075,6 +4075,12 @@ decltype (new int{}) f1<int>(int)
--format=gnu-v3
_Zli2_wPKc
operator"" _w(char const*)
+--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.
#