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++/33754] Default argument of type list < pair < A, B > > compiles only when typedef is used



------- Comment #7 from photon at seznam dot cz  2007-10-16 09:23 -------
(In reply to comment #6)
> 
> What are your thoughts about the other issues raised by 325?
> 

The suggested resolution disregards the syntactical needs of templates and
makes 'int Foo (int i = T<1, int>::i);' invalid. The current standard is
inconsistent and should be fixed. For example, the following code is invalid:

class A
{
        void f (T a);
        typedef int T;
};

Yet, this one is not:

class B
{
        void f (int a = (T) 1);
        typedef int T;
};

This inconsistency is unexpected and confusing. Default arguments should be
strictly required to be parsed at the point of appearance. Deferred parsing
brings very little benefit here, yet the price paid for it is high: template
argument separator does not work as expected.


-- 


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


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