|
Boost : |
From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-03-11 02:10:39
Daniel Frey <d.frey_at_[hidden]> wrote:
[...]
I tried following code:
#include <iostream>
template <typename T> class V {};
template <template <typename> class T> struct B {};
struct D : B<V> {};
template <typename T>
void f (const B<T>&)
{
std::cout << typeid(T).name() << std::endl;
}
int main()
{
D d;
f (d);
}
According to Comeau compiler and GCC this program is invalid. I have
following error messages
(from GCC 3.3.1):
T246.cpp:6: error: type/value mismatch at argument 1 in template
parameter list
for `template<template<class> class T> struct B'
T246.cpp:6: error: expected a class template, got `T'
T246.cpp:7: error: ISO C++ forbids declaration of `parameter' with no
type
T246.cpp: In function `int main()':
T246.cpp:13: error: no matching function for call to `f(D&)'
(from Comeau online 4.3.3 beta)
"ComeauTest.c", line 6: error: template parameter "T" is not a class
template
void f (const B<T>&)
^
"ComeauTest.c", line 13: error: no instance of function template "f"
matches the
argument list
The argument types that you used are: (D)
f (d);
^
... however it compiles under VC71, and the output of this program is:
class V
I think that's a surprise?
B.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk