typeof throws away the reference
Gabriel Dos Reis
gdr@integrable-solutions.net
Fri Jan 28 17:00:00 GMT 2005
Jari Petter Sundell <jaris@student.matnat.uio.no> writes:
| Compiling the following on g++-3.3 and 3.5-tree-ssa does not give a
| "could not convert `0' to ` int&'" for either of the assignments. Why
| doesn't typeof preserve the reference?
Because that is the way it was designed (parallel sizeof).
That is a known issue -- look for lengthy discussions on the boost
mailing lists. For the future, C++ will support reference- and
non-reference-preserving type queries. Look for the last papers on
this issue (the last revision have splitted the auto proposal -- much
like typeof except you don't have to repeat expressions -- and
decltype -- much like typeof but preserves refernces).
--
Gabriel Dos Reis
gdr@integrable-solutions.net
More information about the Gcc
mailing list