Possible bug with template template parameters in VC++ 7.0 
Author Message
 Possible bug with template template parameters in VC++ 7.0

The following program attempts to instantiated template A using
template B as a template template parameter.  Version 13.00.9466 of
VC++ produces the following error message when this program is
compiled:

test.cpp(19) : error C3201: the template parameter list for class
template 'B' does not match the template parameter list for template
parameter 'X'

However, the error message is wrong.  Template B DOES match the X
parameter.

The program compiles and runs under the GNU C++ compiler.  

#include <iostream>

template <template <int T> class X>
class A
{
public:
        X<true> x;

Quote:
};

template <int T>
class B
{
public:
        enum { bb = T };

Quote:
};

main()
{
        A<B> a;
        std::cout << a.x.bb << std::endl;
Quote:
}



Tue, 17 Aug 2004 23:23:37 GMT  
 Possible bug with template template parameters in VC++ 7.0
Try this:

    A< B<0> > a;

-Sean



Wed, 18 Aug 2004 00:01:14 GMT  
 Possible bug with template template parameters in VC++ 7.0
No: this is not the correct fix. The code as it is written is valid. The
fact that is does not compile is due to a bug in Visual C++ 7.0.

This bug is fixed in the next version of the compiler.

--
Jonathan Caves
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Try this:

>     A< B<0> > a;

> -Sean



Wed, 18 Aug 2004 01:38:26 GMT  
 Possible bug with template template parameters in VC++ 7.0

Quote:
> No: this is not the correct fix. The code as it is written is valid. The
> fact that is does not compile is due to a bug in Visual C++ 7.0.

I see now.  My bad.

Quote:
> This bug is fixed in the next version of the compiler.

What is the bug in more general terms?  Is it not able to implicitly cast
from the bool expression into the int template parameter?

-Sean



Wed, 18 Aug 2004 02:06:54 GMT  
 Possible bug with template template parameters in VC++ 7.0
Sean: in general terms: the compiler does not handle template template
parameters where one or more parmeters of the template template parameter is
a non-type parameter. Make sense ;-)

--
Jonathan Caves
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> > No: this is not the correct fix. The code as it is written is valid. The
> > fact that is does not compile is due to a bug in Visual C++ 7.0.

> I see now.  My bad.

> > This bug is fixed in the next version of the compiler.

> What is the bug in more general terms?  Is it not able to implicitly cast
> from the bool expression into the int template parameter?

> -Sean



Wed, 18 Aug 2004 02:11:31 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VC 7.1 final beta: bug with template template parameters

2. Bug in inheritance from template template parameters in VC7

3. VC++ 7.0 bug with typedef & template instantiation

4. template template parameter that VC++ does NOT support

5. VC7 does NOT support template-template parameters involving non-type parameters

6. VC++ 4.2 MFC - Possible bug in the Copy member function of a CArray template

7. template template parameter with default value (VS.NET 2003)

8. Templates as a templates-parameters

9. Template class as template parameter

10. template template parameters

11. template with template parameter

12. Template Template Parameters

 

 
Powered by phpBB® Forum Software