[Bug c++/56685] New: default template parameter cannot precede a non-default template parameter in a function

gessos.paul at yahoo dot gr gcc-bugzilla@gcc.gnu.org
Thu Mar 21 21:51:00 GMT 2013


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: unassigned@gcc.gnu.org
        ReportedBy: gessos.paul@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;
}



More information about the Gcc-bugs mailing list