re PR c++/62219 ([c++11] Spurious error for lambda in a friend function of a class...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 22 Sep 2014 19:21:20 +0000 (19:21 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 22 Sep 2014 19:21:20 +0000 (19:21 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C [new file with mode: 0644]

index 3dc8c7c3a3ba009ea9f4bd83666d28887fdf141a..7d23a773ab1337a5a82b9b793bd5bccea644393b 100644 (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.
index 8a12713471b83b42d3cadd59369ae534a225761d..da8bd8f30f63f64b7b8ea4a27e27634189c87ef8 100644 (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;
index efbb084ddb7cc0a382b98bf98d621346dfa3d350..08ba76443b12a4b852bca7084ed205bcf8ae5e09 100644 (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.
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 (file)
index 0000000..b73ef75
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/62219
+// { dg-do compile { target c++11 } }
+
+template< class = void >
+struct S
+{
+  friend void foo( S )
+  {
+    [](){};
+  }
+};