From: Jason Merrill Date: Tue, 17 Jun 2014 23:03:43 +0000 (-0400) Subject: re PR c++/60605 (incorrect diagosis of default template argument for function declara... X-Git-Tag: releases/gcc-4.8.4~406 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a97a1341a781d5c563c75022c83abda96a0dfdf;p=thirdparty%2Fgcc.git 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: r211753 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f3d7c8c9c729..c89da1356e10 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-17 Jason Merrill + + PR c++/60605 + * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. + 2014-06-02 Jason Merrill PR c++/61134 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 85b46fe0809c..a4e1a591f9ab 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4308,7 +4308,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. */ diff --git a/gcc/testsuite/g++.dg/template/local-fn1.C b/gcc/testsuite/g++.dg/template/local-fn1.C new file mode 100644 index 000000000000..88acd17d7416 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local-fn1.C @@ -0,0 +1,8 @@ +// PR c++/60605 + +template +struct Foo { + void bar() { + void bug(); + } +};