public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67838] New: Rejects-valid-code: templated lambda variable.
@ 2015-10-04 12:31 bisqwit at iki dot fi
  2015-10-04 12:41 ` [Bug c++/67838] " bisqwit at iki dot fi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bisqwit at iki dot fi @ 2015-10-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67838
           Summary: Rejects-valid-code: templated lambda variable.
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

GCC 5.2 fails to compile the code below, erroneously citing "error: use of
'TestFunc<false>' before deduction of 'auto'".
Compiles fine in Clang 3.5.

#include <stdio.h>

template<bool LMode>
static auto TestFunc = [](int param1)
{
    return param1;
};

template<typename Func>
static void test(Func func)
{
    printf("%d\n", func(12345));
}

int main()
{
    test(TestFunc<false>);
    test(TestFunc<true>);
}


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

* [Bug c++/67838] Rejects-valid-code: templated lambda variable.
  2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
@ 2015-10-04 12:41 ` bisqwit at iki dot fi
  2015-10-04 12:51 ` trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bisqwit at iki dot fi @ 2015-10-04 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Joel Yliluoma <bisqwit at iki dot fi> ---
Note that the use of "template" here is to declare a parametric variable. It is
not for the function's parameter list. It works the same way as in this
expression:

template<bool LMode>
int v = 3*LMode;


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

* [Bug c++/67838] Rejects-valid-code: templated lambda variable.
  2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
  2015-10-04 12:41 ` [Bug c++/67838] " bisqwit at iki dot fi
@ 2015-10-04 12:51 ` trippels at gcc dot gnu.org
  2015-10-22 14:50 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-10-04 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-04
                 CC|                            |trippels at gcc dot gnu.org
      Known to work|                            |6.0
     Ever confirmed|0                           |1
      Known to fail|                            |5.2.1
           Severity|major                       |normal

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Confirmed. Working fine with gcc-6.


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

* [Bug c++/67838] Rejects-valid-code: templated lambda variable.
  2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
  2015-10-04 12:41 ` [Bug c++/67838] " bisqwit at iki dot fi
  2015-10-04 12:51 ` trippels at gcc dot gnu.org
@ 2015-10-22 14:50 ` paolo.carlini at oracle dot com
  2015-10-22 14:55 ` paolo at gcc dot gnu.org
  2015-10-22 14:56 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-10-22 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm going to add a testcase to trunk and close the bug, then.


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

* [Bug c++/67838] Rejects-valid-code: templated lambda variable.
  2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
                   ` (2 preceding siblings ...)
  2015-10-22 14:50 ` paolo.carlini at oracle dot com
@ 2015-10-22 14:55 ` paolo at gcc dot gnu.org
  2015-10-22 14:56 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-10-22 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Oct 22 14:55:14 2015
New Revision: 229175

URL: https://gcc.gnu.org/viewcvs?rev=229175&root=gcc&view=rev
Log:
2015-10-22  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/67838
        * g++.dg/cpp1y/var-templ46.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/var-templ46.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/67838] Rejects-valid-code: templated lambda variable.
  2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
                   ` (3 preceding siblings ...)
  2015-10-22 14:55 ` paolo at gcc dot gnu.org
@ 2015-10-22 14:56 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-10-22 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

end of thread, other threads:[~2015-10-22 14:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-04 12:31 [Bug c++/67838] New: Rejects-valid-code: templated lambda variable bisqwit at iki dot fi
2015-10-04 12:41 ` [Bug c++/67838] " bisqwit at iki dot fi
2015-10-04 12:51 ` trippels at gcc dot gnu.org
2015-10-22 14:50 ` paolo.carlini at oracle dot com
2015-10-22 14:55 ` paolo at gcc dot gnu.org
2015-10-22 14:56 ` paolo.carlini at oracle dot com

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).