Bug 56685 - default template parameter cannot precede a non-default template parameter in a function
Summary: default template parameter cannot precede a non-default template parameter in...
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-21 21:51 UTC by Chameleon
Modified: 2013-03-22 10:25 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.8.0, 4.9.0
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chameleon 2013-03-21 21:51:06 UTC
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;
}
Comment 1 Paolo Carlini 2013-03-22 10:25:50 UTC
4.8.0 is fine and the issue isn't a regression.