From: Paolo Carlini Date: Mon, 22 Sep 2014 19:21:20 +0000 (+0000) Subject: re PR c++/62219 ([c++11] Spurious error for lambda in a friend function of a class... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=05424ee6ec0d20b028649cce108ed442863f1063;p=gcc.git re PR c++/62219 ([c++11] Spurious error for lambda in a friend function of a class template with a default template parameters) /cp 2014-09-22 Paolo Carlini PR c++/62219 * pt.c (check_default_tmpl_args): Check LAMBDA_FUNCTION_P. /testsuite 2014-09-22 Paolo Carlini PR c++/62219 * g++.dg/cpp0x/lambda/lambda-template14.C: New. From-SVN: r215477 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3dc8c7c3a3b..7d23a773ab1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-09-22 Paolo Carlini + + PR c++/62219 + * pt.c (check_default_tmpl_args): Check LAMBDA_FUNCTION_P. + 2014-09-22 Jason Merrill * decl.c (poplevel): Don't warn about unused vars in template scope. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8a12713471b..da8bd8f30f6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4456,9 +4456,11 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, local scope. */ return true; - if (TREE_CODE (decl) == TYPE_DECL - && TREE_TYPE (decl) - && LAMBDA_TYPE_P (TREE_TYPE (decl))) + if ((TREE_CODE (decl) == TYPE_DECL + && TREE_TYPE (decl) + && LAMBDA_TYPE_P (TREE_TYPE (decl))) + || (TREE_CODE (decl) == FUNCTION_DECL + && LAMBDA_FUNCTION_P (decl))) /* A lambda doesn't have an explicit declaration; don't complain about the parms of the enclosing class. */ return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efbb084ddb7..08ba76443b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-22 Paolo Carlini + + PR c++/62219 + * g++.dg/cpp0x/lambda/lambda-template14.C: New. + 2014-09-22 Alan Lawrence * gcc.dg/vect/vect-reduc-or_1.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C new file mode 100644 index 00000000000..b73ef753e08 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C @@ -0,0 +1,11 @@ +// PR c++/62219 +// { dg-do compile { target c++11 } } + +template< class = void > +struct S +{ + friend void foo( S ) + { + [](){}; + } +};