diff options
author | Jason Merrill <jason@redhat.com> | 2012-03-21 00:04:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-03-21 00:04:39 -0400 |
commit | c19267cbaf0188acd862e628b72fb32e68d08d48 (patch) | |
tree | d78ec393143f330e334e0d1388fbcd7568ca8b93 /gcc | |
parent | f17dd5dad399612fb6be1ad666fdb43ff97f8418 (diff) | |
download | gcc-c19267cbaf0188acd862e628b72fb32e68d08d48.zip gcc-c19267cbaf0188acd862e628b72fb32e68d08d48.tar.gz gcc-c19267cbaf0188acd862e628b72fb32e68d08d48.tar.bz2 |
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: r185595
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/init.c | 4 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/auto32.C | 9 |
5 files changed, 27 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5fbf3f5..8dcc4462 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 1b2a1ef..bcb5ab7 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 5d6beb5..1536828 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 cca054e..71f1fe7 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 0000000..2aad34e --- /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); +} |