From: Marek Polacek Date: Mon, 23 Dec 2013 12:14:56 +0000 (+0000) Subject: re PR c++/59111 ([c++11] ICE on invalid usage of auto in return type) X-Git-Tag: releases/gcc-4.9.0~1941 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae8310ec6eba51ef6d39d3fd25ffcec7f9da3759;p=thirdparty%2Fgcc.git re PR c++/59111 ([c++11] ICE on invalid usage of auto in return type) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98022633e0f3..e4896d5c0fab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-23 Marek Polacek + + PR c++/59111 + * search.c (lookup_conversions): Return NULL_TREE if !CLASS_TYPE_P. + 2013-12-20 Trevor saunders * semantics.c (build_anon_member_initialization): Replace diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 166ac116fd34..b700be9a7e25 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0efe2ac2554..fbd5ba13160a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-12-23 Marek Polacek + + PR c++/59111 + * g++.dg/cpp0x/pr59111.C: New test. + * g++.dg/cpp1y/pr59110.C: New test. + 2013-12-22 Uros Bizjak * 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 index 000000000000..14b45b14b092 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr59111.C @@ -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 index 000000000000..dbbfa9b41dec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr59110.C @@ -0,0 +1,4 @@ +// PR c++/59110 +// { dg-options "-std=c++1y" } + +int i = *(auto*)0; // { dg-error "cannot convert" }