re PR c++/59111 ([c++11] ICE on invalid usage of auto in return type)
authorMarek Polacek <polacek@redhat.com>
Mon, 23 Dec 2013 12:14:56 +0000 (12:14 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 23 Dec 2013 12:14:56 +0000 (12:14 +0000)
PR c++/59111
cp/
* search.c (lookup_conversions): Return NULL_TREE if !CLASS_TYPE_P.
testsuite/
* g++.dg/cpp0x/pr59111.C: New test.
* g++.dg/cpp1y/pr59110.C: New test.

From-SVN: r206177

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr59111.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/pr59110.C [new file with mode: 0644]

index 98022633e0f35847ae2fa88b9c09bd2d18a249b7..e4896d5c0fab429ef60db0dc8ffbf2706d560a9d 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-23  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/59111
+       * search.c (lookup_conversions): Return NULL_TREE if !CLASS_TYPE_P.
+
 2013-12-20  Trevor saunders  <tsaunders@mozilla.com>
 
        * semantics.c (build_anon_member_initialization): Replace
index 166ac116fd345260a05485cb58134bd1bf56b496..b700be9a7e259d66c62d6a7df4872eef79d4944d 100644 (file)
@@ -2506,7 +2506,7 @@ lookup_conversions (tree type)
   tree list = NULL_TREE;
 
   complete_type (type);
-  if (!TYPE_BINFO (type))
+  if (!CLASS_TYPE_P (type) || !TYPE_BINFO (type))
     return NULL_TREE;
 
   lookup_conversions_r (TYPE_BINFO (type), 0, 0,
index d0efe2ac25546c90934149158efc4d0adb4dc0e5..fbd5ba13160ae1db101c6622f5970c17693937f0 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-23  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/59111
+       * g++.dg/cpp0x/pr59111.C: New test.
+       * g++.dg/cpp1y/pr59110.C: New test.
+
 2013-12-22  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/x86_64/abi/callabi/func-2a.c (dg-do): Remove
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr59111.C b/gcc/testsuite/g++.dg/cpp0x/pr59111.C
new file mode 100644 (file)
index 0000000..14b45b1
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/59111
+// { dg-do compile { target c++11 } }
+
+auto& foo();   // { dg-error "type specifier without trailing return type" }
+int i = foo(); // { dg-error "cannot convert" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59110.C b/gcc/testsuite/g++.dg/cpp1y/pr59110.C
new file mode 100644 (file)
index 0000000..dbbfa9b
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/59110
+// { dg-options "-std=c++1y" }
+
+int i = *(auto*)0; // { dg-error "cannot convert" }