diff mbox

C++ PATCH to implement N3582 changes to proposed C++14 return type deduction

Message ID 51758611.5000505@redhat.com
State New
Headers show

Commit Message

Jason Merrill April 22, 2013, 6:48 p.m. UTC
On 03/29/2013 03:51 PM, Jason Merrill wrote:
> I've updated my proposal for return type deduction for normal functions
> in C++14 for the upcoming Bristol meeting:
>
>    http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3582.html
>
> and this patch implements the changes in the new proposal relative to
> the previous revision.

But I forgot to mangle decltype(auto)....
diff mbox

Patch

commit 962ed442fc4ce39f24aeec858436a82bcc77fa35
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Apr 20 15:39:42 2013 +0100

    	* mangle.c (write_type): Mangle decltype(auto).

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 83c3e62..8da62b5 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2019,7 +2019,10 @@  write_type (tree type)
 	    case TEMPLATE_TYPE_PARM:
 	      if (is_auto (type))
 		{
-		  write_identifier ("Da");
+		  if (AUTO_IS_DECLTYPE (type))
+		    write_identifier ("Dc");
+		  else
+		    write_identifier ("Da");
 		  ++is_builtin_type;
 		  break;
 		}
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-mangle1.C b/gcc/testsuite/g++.dg/cpp1y/auto-mangle1.C
new file mode 100644
index 0000000..834cfc3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-mangle1.C
@@ -0,0 +1,12 @@ 
+// Mangling for decltype(auto)
+// { dg-options "-std=c++1y" }
+
+void f();
+
+// { dg-final { scan-assembler "_Z2g1IiEDcv" } }
+template <class T> decltype(auto) g1() { return &f; }
+template decltype(auto) g1<int>();
+
+// { dg-final { scan-assembler "_Z2g2IiEDav" } }
+template <class T> auto g2() { return &f; }
+template auto g2<int>();