This is the mail archive of the gcc@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]

template class with default parameter in template parameter declaration


Complicated title, here's a bit of code:

#ifdef FIX
# define PARM2 , class T5
#else
# define PARMS2
#endif


template<typename T1, typename T2 = int>
struct cl1 {
};

template<template<class T3 PARM2> class T4 = cl1>
struct cl2 {
};

cl2<> var;

If compiled without FIX defined this will fail with gcc 4.3 and later.
 Haven't checked 4.2 but it works without the fix with gcc 4.1.  The
strange thing is that it also worked with ancient compilers before the
C++ frontend rewrite (gcc 3.2).  In short, when a expecting a template
class in a template parameter list it now is not possible anymore to
skip the default parameters.  Since this is an actual use of the class
(in case the default is used) and the programmer declares to have no
interest in the type of the second template parameter I wouldn't say
it is needed but I haven't tracked a statement in the standard.

Before changing too much code I want to make sure this new and very
old behavior is what is required by the standard and not a bug which
slipped in again.


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