re PR c++/60605 (incorrect diagosis of default template argument for function declaration inside class template member function)

PR c++/60605
	* pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P.

From-SVN: r211754
This commit is contained in:
Jason Merrill 2014-06-17 19:09:20 -04:00 committed by Jason Merrill
parent b511626828
commit 5a96dac608
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2014-06-17 Jason Merrill <jason@redhat.com>
PR c++/60605
* pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P.
2014-06-15 Jason Merrill <jason@redhat.com>
PR c++/61488

View file

@ -4418,7 +4418,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
in the template-parameter-list of the definition of a member of a
class template. */
if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL)
if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL
|| (TREE_CODE (decl) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (decl)))
/* You can't have a function template declaration in a local
scope, nor you can you define a member of a class template in a
local scope. */

View file

@ -0,0 +1,8 @@
// PR c++/60605
template <typename T = int>
struct Foo {
void bar() {
void bug();
}
};