Category
C++-Specific Keywords
Syntax 1
typename identifier
Syntax 2
template < typename identifier > class identifier
Description
Use the syntax 1 to reference a type that you have not yet defined. See example 1.
Use syntax 2 in place of the class keyword in a template declaration. See example 2.
#include <stdio.h> struct A{ typedef int AInt; };
bc++bcc32 test.cpp
The result is no error. The Compiler should not assume AInt is a typename, but it does unless -A switch is used
bc++bcc32 -A test.cpp
The result is:
Error E2089 47071.cpp 7: Identifier 'AInt' cannot have a type qualifier
Error E2303 47071.cpp 7: Type name expected
Error E2139 47071.cpp 7: Declaration missing ;
Both results are as expected.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|