diff options
author | Jason Merrill <jason@redhat.com> | 2014-06-17 19:09:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-06-17 19:09:20 -0400 |
commit | 5a96dac608806ab37202bb7a4275a0f84755bde5 (patch) | |
tree | 17ddfa51adbd4d5297c171ec8dbec42f6379bd84 /gcc | |
parent | b511626828a636ed6310cd94c4fa78365450fb34 (diff) | |
download | gcc-5a96dac608806ab37202bb7a4275a0f84755bde5.zip gcc-5a96dac608806ab37202bb7a4275a0f84755bde5.tar.gz gcc-5a96dac608806ab37202bb7a4275a0f84755bde5.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/local-fn1.C | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5a8c01d..9705f64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index df57293..d5cc257 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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. */ 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 0000000..88acd17 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local-fn1.C @@ -0,0 +1,8 @@ +// PR c++/60605 + +template <typename T = int> +struct Foo { + void bar() { + void bug(); + } +}; |