public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer
@ 2012-10-01  6:43 leonid at volnitsky dot com
  2012-10-01 11:55 ` [Bug c++/54764] " daniel.kruegler at googlemail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: leonid at volnitsky dot com @ 2012-10-01  6:43 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

             Bug #: 54764
           Summary: In class initialization of non-static lambda member
                    can't be used in class with default template paramer
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: leonid@volnitsky.com


Clang-3.2 compiles (FWIW), but rejected by GCC 4.7.1 and 4.8:

------------------------------------------------------------------
#include <functional>

template<class T=void>
struct  c{
    std::function<int(int)> f = [](int i){return i+i;};
};

int main() {}
-------------------------------------------------------------------

Error message:

t.cc:6:31: error: default argument for template parameter for class enclosing
‘struct __lambda0’
  function<int(int)> f = [](int i){return i+i;};
                               ^


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/54764] In class initialization of non-static lambda member can't be used in class with default template paramer
  2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
@ 2012-10-01 11:55 ` daniel.kruegler at googlemail dot com
  2012-10-01 12:09 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-01 11:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-10-01 11:54:47 UTC ---
Simplified to get rid of library dependencies:

//-------------------
template<class T = void>
struct c
{
  int (*f)(int) = [](int i){return i + i;};
};
//-------------------


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/54764] In class initialization of non-static lambda member can't be used in class with default template paramer
  2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
  2012-10-01 11:55 ` [Bug c++/54764] " daniel.kruegler at googlemail dot com
@ 2012-10-01 12:09 ` paolo.carlini at oracle dot com
  2013-03-12 21:41 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-01 12:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-01
             Blocks|                            |54367
     Ever Confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-01 12:09:09 UTC ---
lambdas need work


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/54764] In class initialization of non-static lambda member can't be used in class with default template paramer
  2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
  2012-10-01 11:55 ` [Bug c++/54764] " daniel.kruegler at googlemail dot com
  2012-10-01 12:09 ` paolo.carlini at oracle dot com
@ 2013-03-12 21:41 ` jason at gcc dot gnu.org
  2013-03-17  2:40 ` jason at gcc dot gnu.org
  2013-03-23  5:09 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-12 21:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/54764] In class initialization of non-static lambda member can't be used in class with default template paramer
  2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
                   ` (2 preceding siblings ...)
  2013-03-12 21:41 ` jason at gcc dot gnu.org
@ 2013-03-17  2:40 ` jason at gcc dot gnu.org
  2013-03-23  5:09 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-17  2:40 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-17 02:39:05 UTC ---
Author: jason
Date: Sun Mar 17 02:38:50 2013
New Revision: 196742

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196742
Log:
    PR c++/54764
    PR c++/55972
    * name-lookup.h (tag_scope): Add ts_lambda.
    * semantics.c (begin_lambda_type): Use it.
    * decl.c (xref_tag_1): Set CLASSTYPE_LAMBDA_EXPR.
    * pt.c (check_default_tmpl_args): Ignore lambdas.
    (push_template_decl_real): Handle lambdas.
    * tree.c (no_linkage_check): Adjust lambda check.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg4.C
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/name-lookup.h
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/tree.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/54764] In class initialization of non-static lambda member can't be used in class with default template paramer
  2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
                   ` (3 preceding siblings ...)
  2013-03-17  2:40 ` jason at gcc dot gnu.org
@ 2013-03-23  5:09 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-23  5:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.1

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-23 05:09:17 UTC ---
Fixed for 4.8.1.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-23  5:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-01  6:43 [Bug c++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer leonid at volnitsky dot com
2012-10-01 11:55 ` [Bug c++/54764] " daniel.kruegler at googlemail dot com
2012-10-01 12:09 ` paolo.carlini at oracle dot com
2013-03-12 21:41 ` jason at gcc dot gnu.org
2013-03-17  2:40 ` jason at gcc dot gnu.org
2013-03-23  5:09 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).