[Bug c++/2892] array addresses corrupted when using template classes

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 28 07:44:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-04-28 06:48 -------
That is actually a pretty good point -- the function that fails is the 
only one where the type of the argument is not deducted but explicitly 
specified as a template argument, namely int[2]. It would seem to be 
that it is indeed passed by value, which is what the compiler warns about. 
Running the program subsequently fails. 
 
In all the other cases, the deduced type for the argument should be a 
reference, and taking the address should and does yield the correct result. 
Likewise, if I change the argument of the failing function to take a  
reference F&, then the program succeeds. 
 
Nathan, what do you think? Was this just as oversight, or am I missing 
something? I believe that Andrew is actually right here. 
 
W. 

-- 


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



More information about the Gcc-bugs mailing list