re PR c++/53624 (GCC rejects function local types in template function with default template arguments)

/cp
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53624
	* pt.c (check_default_tmpl_args): Don't check local types.

/testsuite
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53624
	* g++.dg/cpp0x/temp_default5.C: New.

From-SVN: r190001
This commit is contained in:
Paolo Carlini 2012-07-31 09:46:46 +00:00 committed by Paolo Carlini
parent 3ad45f7ff3
commit 8dca7e9303
4 changed files with 26 additions and 4 deletions

View File

@ -1,8 +1,12 @@
2012-07-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53624
* pt.c (check_default_tmpl_args): Don't check local types.
2012-07-25 Sandra Loosemore <sandra@codesourcery.com>
Paul Brook <paul@codesourcery.com>
PR target/53633
* decl.c (finish_function): Check targetm.warn_func_return.
2012-07-25 Jason Merrill <jason@redhat.com>

View File

@ -4267,7 +4267,8 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
/* Core issue 226 (C++0x only): the following only applies to class
templates. */
if ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL)
if (is_primary
&& ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL))
{
/* [temp.param]
@ -4299,8 +4300,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
TREE_PURPOSE (parm) = error_mark_node;
no_errors = false;
}
else if (is_primary
&& !is_partial
else if (!is_partial
&& !is_friend_decl
/* Don't complain about an enclosing partial
specialization. */

View File

@ -1,3 +1,8 @@
2012-07-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53624
* g++.dg/cpp0x/temp_default5.C: New.
2012-07-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/51081

View File

@ -0,0 +1,13 @@
// { dg-options "-std=c++11" }
template <class Z = void, class T>
void Foo(T)
{
struct X {};
}
template <class T = int, typename U>
void f(const U&)
{
auto g = [] () {};
}