This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: typeof throws away the reference
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Jari Petter Sundell <jaris at student dot matnat dot uio dot no>
- Cc: gcc at gcc dot gnu dot org
- Date: 28 Jan 2005 17:02:28 +0100
- Subject: Re: typeof throws away the reference
- Organization: Integrable Solutions
- References: <Pine.LNX.4.58-L.0501281531490.28742@northri.ifi.uio.no>
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