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
This commit is contained in:
Jason Merrill 2008-08-30 19:12:45 -04:00 committed by Jason Merrill
parent a4cbe62dd9
commit 0257eee5bd
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2008-08-30 Jason Merrill <jason@redhat.com>
PR c++/37288
* pt.c (dependent_type_p): Don't abort on auto outside of a template.
2008-08-29 Jason Merrill <jason@redhat.com>
Implement C++0x 'auto' semantics.

View file

@ -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;
}

View file

@ -14,3 +14,10 @@ struct A { };
A<int> A1;
// CWG issue 625
A<auto> A2 = A1; // { dg-error "auto" }
auto foo() { } // { dg-error "auto" }
void bar(auto i) // { dg-error "incomplete|auto" }
{
(void)i;
}