From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23880 invoked by alias); 29 Apr 2004 00:25:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23851 invoked by uid 48); 29 Apr 2004 00:25:21 -0000 Date: Thu, 29 Apr 2004 00:45:00 -0000 Message-ID: <20040429002521.23849.qmail@sources.redhat.com> From: "giovannibajo at libero dot it" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20010521155602.2892.goyette@sgi.com> References: <20010521155602.2892.goyette@sgi.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/2892] array addresses corrupted when using template classes X-Bugzilla-Reason: CC X-SW-Source: 2004-04/txt/msg02784.txt.bz2 List-Id: ------- Additional Comments From giovannibajo at libero dot it 2004-04-29 00:25 ------- (In reply to comment #12) > The question then is: is gcc wrong to pass by value? Of course. After instantiation, the function signature is "void* Foo(int arg [2])". There is nothing like "passing an array by value", and the automatic array-to-pointer decay should apply (so that the semantic of the call matches "void* Foo(int* arg)"). Notice that the instantion is still "T=int[2]", and thus different from "T=int*", but the call semantic would be same. This is what Nathan says in comment #6: we don't do this decay for template functions, and this is our bug. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2892