public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile
@ 2015-07-28  5:45 ldionne.2 at gmail dot com
  2015-07-28  9:43 ` [Bug c++/67041] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ldionne.2 at gmail dot com @ 2015-07-28  5:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

            Bug ID: 67041
           Summary: [C++14] Variable template initialized by call to
                    lambda does not compile
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com
  Target Milestone: ---

The following code does not compile on GCC trunk:

-------------------------------
template <typename ...Anything>
auto variable_template = [] { return 1; }();

int main() {
    variable_template<>;
}
-------------------------------

The error is 

---------------------------------
prog.cc: In instantiation of 'auto variable_template<>':
prog.cc:5:5:   required from here
prog.cc:2:42: error: use of 'variable_template<>' before deduction of 'auto'
 auto variable_template = [] { return 1; }();
                                          ^
prog.cc:2:42: error: use of '<lambda()> [with Anything = {}]' before deduction
of 'auto'
---------------------------------

Live example: http://melpon.org/wandbox/permlink/srH8coYkvigwJSkb

Note that Clang compiles this code fine.


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

* [Bug c++/67041] [C++14] Variable template initialized by call to lambda does not compile
  2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
@ 2015-07-28  9:43 ` redi at gcc dot gnu.org
  2015-08-26 19:02 ` ldionne.2 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-28  9:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-28
     Ever confirmed|0                           |1


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

* [Bug c++/67041] [C++14] Variable template initialized by call to lambda does not compile
  2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
  2015-07-28  9:43 ` [Bug c++/67041] " redi at gcc dot gnu.org
@ 2015-08-26 19:02 ` ldionne.2 at gmail dot com
  2015-09-08 19:19 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ldionne.2 at gmail dot com @ 2015-08-26 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

--- Comment #1 from Louis Dionne <ldionne.2 at gmail dot com> ---
Can be simplified to:

    template <typename ...Anything>
    auto variable_template = [] { };

    int main() {
        variable_template<>;
    }

Still fails on GCC trunk.


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

* [Bug c++/67041] [C++14] Variable template initialized by call to lambda does not compile
  2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
  2015-07-28  9:43 ` [Bug c++/67041] " redi at gcc dot gnu.org
  2015-08-26 19:02 ` ldionne.2 at gmail dot com
@ 2015-09-08 19:19 ` jason at gcc dot gnu.org
  2015-09-08 19:34 ` jason at gcc dot gnu.org
  2015-09-08 20:39 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2015-09-08 19:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |norbert.pfeiler+gcc.gnu.org
                   |                            |/bugzilla at gmail dot com

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
*** Bug 67350 has been marked as a duplicate of this bug. ***


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

* [Bug c++/67041] [C++14] Variable template initialized by call to lambda does not compile
  2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
                   ` (2 preceding siblings ...)
  2015-09-08 19:19 ` jason at gcc dot gnu.org
@ 2015-09-08 19:34 ` jason at gcc dot gnu.org
  2015-09-08 20:39 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2015-09-08 19:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Sep  8 19:33:47 2015
New Revision: 227553

URL: https://gcc.gnu.org/viewcvs?rev=227553&root=gcc&view=rev
Log:
        PR c++/67041
        * pt.c (tsubst_copy_and_build): Handle variables like functions.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-var-templ1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c


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

* [Bug c++/67041] [C++14] Variable template initialized by call to lambda does not compile
  2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
                   ` (3 preceding siblings ...)
  2015-09-08 19:34 ` jason at gcc dot gnu.org
@ 2015-09-08 20:39 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2015-09-08 20:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041

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

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 6.


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

end of thread, other threads:[~2015-09-08 20:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  5:45 [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile ldionne.2 at gmail dot com
2015-07-28  9:43 ` [Bug c++/67041] " redi at gcc dot gnu.org
2015-08-26 19:02 ` ldionne.2 at gmail dot com
2015-09-08 19:19 ` jason at gcc dot gnu.org
2015-09-08 19:34 ` jason at gcc dot gnu.org
2015-09-08 20:39 ` 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).