Geoff Chappell - Software Analyst
ROUGH DRAFT
Visual C++ Compiler Error C2745
Message Text
'token' : this token cannot be converted to an identifier
Circumstances
Error C2745 occurs because the argument given to an __identifier
keyword is invalid. The token placeholder in the
message text describes the argument as a type of token.
The __identifier keyword acts as an operator in
the token stream. It takes as its one argument a token and it returns this token
as an identifer. This is especially useful when the given token is one that the
compiler might otherwise interpret as a keyword (depending perhaps on whether options
such as /Ze are active).
Conversion is trivial when the given token is anyway an identifier, and is nearly
trivial when the given token is a string. The other types of token that are permitted
are:
- __abstract
- asm
- __asm
- __assume
- auto
- __based
- bool
- __box
- break
- __builtin_alignof
- __builtin_isfloat
- case
- catch
- __cdecl
- char
- class
- __compileBreak
- const
- const_cast
- continue
- __declspec
- default
- __delegate
- delete
- do
- double
- dynamic_cast
- else
- enum
- __event
- __except
- explicit
- extern
- false
- __fastcall
- __feacpBreak
- __fileoffset
- __finally
- float
- for
- __forceinline
- friend
- __gc
- goto
- __hook
- __identifier
- if
- __if_exists
- __if_not_exists
- inline
- int
- __int128
- __int8
- __int16
- __int32
- __int64
- __interface
- __leave
- long
- __multiple_inheritance
- mutable
- namespace
- new
- __nodefault
- __nogc
- __nontemporal
- __novtordisp
- operator
- __pin
- __pragma
- private
- __probability
- __property
- protected
- __ptr32
- __ptr64
- public
- __raise
- register
- reinterpret_cast
- __restrict
- return
- __sealed
- __segname
- short
- signed
- __single_inheritance
- sizeof
- static
- static_cast
- __stdcall
- struct
- __super
- switch
- __sysapi
- template
- this
- __thiscall
- throw
- true
- try
- __try
- __try_cast
- typedef
- typeid
- typename
- __typeof
- __unaligned
- __unhook
- union
- unsigned
- using
- __uuidof
- __value
- virtual
- __virtual_inheritance
- volatile
- void
- __w64
- __wchar_t
- while
Documentation Status
The product documentation says of this error only that “identifiers must be comprised
of legal characters” but there is clearly more to this error.