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



             Bug #: 56685

           Summary: default template parameter cannot precede a

                    non-default template parameter in a function

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: gessos.p...@yahoo.gr





Following code is legal, according to spec, but not compile.



f(0) works fine



g(0) is the same thing, but not compile.



more discussion:

http://stackoverflow.com/questions/11684954/can-function-default-template-parameter-be-put-before-non-default-ones



-----------------------------------

#include <iostream>

#include <array>

#include <vector>



using namespace std;



struct X {};



template <class T = X, typename U>

void f(const U& m) {}



template <class T = X, typename U>

void g(const U& m) { auto ff = [] () {}; }



int main()

{

    f(0);

    g(0);

    return 0;

}

Reply via email to