]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/38597 ([c++0x] ICE when auto return type function given as argument to...
authorJason Merrill <jason@redhat.com>
Sun, 21 Dec 2008 21:01:48 +0000 (16:01 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 21 Dec 2008 21:01:48 +0000 (16:01 -0500)
        PR c++/38597
        * name-lookup.c (arg_assoc_type): Handle DECLTYPE_TYPE.

From-SVN: r142868

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/auto13.C [new file with mode: 0644]

index 19af86ccde6d55d7bff5e75b054b4500e18f1233..94e1a7cd2c10f7afec1f881c3c7c56f059c490dc 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/38597
+       * name-lookup.c (arg_assoc_type): Handle DECLTYPE_TYPE.
+
 2008-12-20  Jakub Jelinek  <jakub@redhat.com>
            Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
index 1ec27c1ffcd722ea1e322caa05dd1beeefa14db6..a7b466217ebd0aaf7e32d07636681d67f8f05f0d 100644 (file)
@@ -2348,12 +2348,12 @@ write_expression (tree expr)
 
        case CAST_EXPR:
          write_type (TREE_TYPE (expr));
+         /* There is no way to mangle a zero-operand cast like
+            "T()".  */
          if (!TREE_OPERAND (expr, 0))
-           /* "T()" is mangled as "T(void)".  */
-           write_char ('v');
+           sorry ("zero-operand casts cannot be mangled due to a defect "
+                  "in the C++ ABI");
          else if (list_length (TREE_OPERAND (expr, 0)) > 1)
-           /* FIXME the above hack for T() needs to be replaced with
-              something more general.  */
            sorry ("mangling function-style cast with more than one argument");
          else
            write_expression (TREE_VALUE (TREE_OPERAND (expr, 0)));
index b5d14b3b39c410aa4c697d800b55b3444fe610ef..4c06afdafacf295bb63c0818908ba2fd7ed28618 100644 (file)
@@ -4701,6 +4701,7 @@ arg_assoc_type (struct arg_lookup *k, tree type)
     case VECTOR_TYPE:
     case BOOLEAN_TYPE:
     case FIXED_POINT_TYPE:
+    case DECLTYPE_TYPE:
       return false;
     case RECORD_TYPE:
       if (TYPE_PTRMEMFUNC_P (type))
index 11feb22bd969f39612b8ea303cabdd56abea98ec..88d4c38b89f763d426d4176b599dd4edbe3a3e64 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/38597
+       * g++.dg/cpp0x/auto13.C: New test.
+
 2008-12-20  Jakub Jelinek  <jakub@redhat.com>
            Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto13.C b/gcc/testsuite/g++.dg/cpp0x/auto13.C
new file mode 100644 (file)
index 0000000..dc7e35a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/38597
+// { dg-options "-std=c++0x" }
+
+template<class T, class U>
+auto f(T,U) -> decltype(T() + U())
+{ return T() + U(); }
+
+template<class T> void g(T){}
+
+int main() { g(f); }           // { dg-error "no matching function" }
+