"Jun Chen" <[EMAIL PROTECTED]> writes:

> Please check the following small program:

This is the wrong mailing list.  Please use [EMAIL PROTECTED] for
questions about using gcc.  The mailing list gcc@gcc.gnu.org is for
developers of gcc itself.  Please take any followups to
[EMAIL PROTECTED]  Thanks.


> {code}
> t1.cpp:56: error: could not convert template argument '0' to 'MyClass*'
> t1.cpp:56: error: invalid type in declaration before ';' token
> t1.cpp: In function 'int main()':
> t1.cpp:63: error: invalid types 'CecMyClass[int]' for array subscript
> t1.cpp:64: error: invalid types 'CecMyClass[int]' for array subscript
> {code}
> 
> I'm really baffled! Since 0 can be assigned to any pointer variable,
> then why "0 could not be converted to MyClass* "?

The C++ standard is clear: "Although 0 is a valid template-argument
for a non-type template-parameter of integral type, it is not a valid
template-argument for a non-type template-parameter of pointer type."
(14.3.2 Template non-type arguments [temp.arg.nontype]).

Ian

Reply via email to