This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67838] New: Rejects-valid-code: templated lambda variable.


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>);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]