[Bug c++/45265] GCC has an intermittent bug when computing the address of function parameters

rogerio at rilhas dot com gcc-bugzilla@gcc.gnu.org
Thu Aug 12 18:39:00 GMT 2010



------- Comment #32 from rogerio at rilhas dot com  2010-08-12 18:38 -------
(In reply to comment #30)
> >you can't even begin to understand how to make a temporary variable an l-value.
> Please look up "move constructors" and rvalue references.  "move constructors"
> are not standard C++ code but the C++ standard committee decided to add rvalue
> references instead.  Please read the history of those and then come back when
> you understand what you are talking about.

If I were to follow your logic I would, because acording to your logic a
parameter doesn't have an address. But C99 doesn't limit this in any way, does
it? The & get the address of the item, period. So I don't need to go look up
unrelated topics, you are the one who should look up address of parameter.

function(class_name(initializer))

... should work if class_name(initializer) were an lvalue. One of you posted a
standard for that. Microsoft can get the address of class_name(initializer),
hence Microsft is capable of looking at class_name(initializer) as an l-value.
How Microsoft does it is not important, they do it and GCC doesn't. So
Microsoft can compile all these equivalently:

int a=10;
function(i)
function(int(20))
function(class_name(initializer))

I don't really care what GCC could do to make class_name(initializer) an
l-value, but if "move constructors" are a good way to go at it then do it. As
C99 doesn't specify this GCC is happy and doesn't need the feel to change. And,
so, I don't call it a bug, just a very nice feature that it is missing.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45265



More information about the Gcc-bugs mailing list