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  <paolo.carlini@oracle.com>

	PR c++/62219
	* pt.c (check_default_tmpl_args): Check LAMBDA_FUNCTION_P.

/testsuite
2014-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/62219
	* g++.dg/cpp0x/lambda/lambda-template14.C: New.

From-SVN: r215477
This commit is contained in:
Paolo Carlini 2014-09-22 19:21:20 +00:00 committed by Paolo Carlini
parent 69e69c01e7
commit 05424ee6ec
4 changed files with 26 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2014-09-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62219
* pt.c (check_default_tmpl_args): Check LAMBDA_FUNCTION_P.
2014-09-22 Jason Merrill <jason@redhat.com>
* decl.c (poplevel): Don't warn about unused vars in template scope.

View file

@ -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;

View file

@ -1,3 +1,8 @@
2014-09-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62219
* g++.dg/cpp0x/lambda/lambda-template14.C: New.
2014-09-22 Alan Lawrence <alan.lawrence@arm.com>
* gcc.dg/vect/vect-reduc-or_1.c: New test.

View file

@ -0,0 +1,11 @@
// PR c++/62219
// { dg-do compile { target c++11 } }
template< class = void >
struct S
{
friend void foo( S )
{
[](){};
}
};