Bug 29084 - parser error, reject valid code.
Summary: parser error, reject valid code.
Status: RESOLVED DUPLICATE of bug 57
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-14 13:32 UTC by Pawel Sikora
Modified: 2006-09-14 15:00 UTC (History)
17 users (show)

See Also:
Host:
Target: *-linux
Build:
Known to work:
Known to fail: 2.95.4 3.3.6 3.4.0 4.1.2 4.2.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2006-09-14 13:32:20 UTC
#include <utility>
template < typename T > struct X { };
struct A
{
        void f( X< std::pair< int, int > > v = X< std::pair< int, int > >() );
};


$ g++ tmp.cpp -Wall -c
tmp.cpp:5: error: expected &#8216;,&#8217; or &#8216;...&#8217; before &#8216;>&#8217; token
tmp.cpp:5: error: wrong number of template arguments (1, should be 2)
/usr/include/c++/4.1.2/bits/stl_pair.h:68: error: provided for &#8216;template<class _T1, class _T2> struct std::pair&#8217;
tmp.cpp:5: error: template argument 1 is invalid
tmp.cpp:5: error: default argument missing for parameter 2 of &#8216;void A::f(X<std::pair<int, int> >, int)&#8217;


online comeau compiler accepts this testcase.
Comment 1 Pawel Sikora 2006-09-14 13:49:05 UTC
reduced testcase:

template < typename T > struct X { };
template < typename T, typename U > struct Y { };
struct A
{
        void f( X< Y< int, int > > v = X< Y< int, int > >() );
};

tmp.cpp:5: error: expected &#8216;,&#8217; or &#8216;...&#8217; before &#8216;>&#8217; token
tmp.cpp:5: error: wrong number of template arguments (1, should be 2)
tmp.cpp:2: error: provided for &#8216;template<class T, class U> struct Y&#8217;
tmp.cpp:5: error: template argument 1 is invalid
tmp.cpp:5: error: default argument missing for parameter 2 of &#8216;void A::f(X<Y<int, int> >, int)&#8217;
Comment 2 Andrew Pinski 2006-09-14 14:59:03 UTC
There is a Defect report about the comma in default arguments.
Comment 3 Andrew Pinski 2006-09-14 15:00:21 UTC
In fact this is a dup of bug 57 which is still SUSPENDED because the defect report has not been resolved yet.

*** This bug has been marked as a duplicate of 57 ***