From: Jason Merrill Date: Sat, 30 Aug 2008 23:12:45 +0000 (-0400) Subject: re PR c++/37288 (ICE using auto as function return type or parameter) X-Git-Tag: releases/gcc-4.4.0~2761 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0257eee5bd4700647061f61b13a2f89b2a4b4f28;p=thirdparty%2Fgcc.git re PR c++/37288 (ICE using auto as function return type or parameter) PR c++/37288 * pt.c (dependent_type_p): Don't abort on auto outside of a template. From-SVN: r139811 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index debbaba46616..7802e7eacdb2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2008-08-30 Jason Merrill + + PR c++/37288 + * pt.c (dependent_type_p): Don't abort on auto outside of a template. + 2008-08-29 Jason Merrill Implement C++0x 'auto' semantics. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3b345f1f4a36..5bb18d99e885 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15892,7 +15892,7 @@ dependent_type_p (tree type) /* If we are not processing a template, then nobody should be providing us with a dependent type. */ gcc_assert (type); - gcc_assert (TREE_CODE (type) != TEMPLATE_TYPE_PARM); + gcc_assert (TREE_CODE (type) != TEMPLATE_TYPE_PARM || is_auto (type)); return false; } diff --git a/gcc/testsuite/g++.dg/cpp0x/auto3.C b/gcc/testsuite/g++.dg/cpp0x/auto3.C index c16ed7b65d18..dc4218bf0234 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto3.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C @@ -14,3 +14,10 @@ struct A { }; A A1; // CWG issue 625 A A2 = A1; // { dg-error "auto" } + +auto foo() { } // { dg-error "auto" } + +void bar(auto i) // { dg-error "incomplete|auto" } +{ + (void)i; +}