On Tue, Nov 8, 2011 at 10:53 AM, Marc Glisse <marc.gli...@inria.fr> wrote:
> On Tue, 8 Nov 2011, Ulrich Drepper wrote:
>
>> 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.
>
> It is announced in:
> http://gcc.gnu.org/gcc-4.2/changes.html
>
> It broke quite a bit of code (in particular with std::vector as cl1), but
> there were some exotic pieces of legal code that were broken by this
> extension, so it had to go.

To expand on that
http://gcc.gnu.org/gcc-4.1/changes.html
Says it was an undocumented extension which was depercated in 4.1 and
will be removed in a later version.
Thanks,
Andrew Pinski

Reply via email to