From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24362 invoked by alias); 16 Dec 2008 03:31:33 -0000 Received: (qmail 24351 invoked by uid 22791); 16 Dec 2008 03:31:32 -0000 X-SWARE-Spam-Status: No, hits=1.2 required=5.0 tests=BAYES_00,DNS_FROM_OPENWHOIS,J_CHICKENPOX_15,J_CHICKENPOX_42,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT,WHOIS_MYPRIVREG X-Spam-Check-By: sourceware.org Received: from kuber.nabble.com (HELO kuber.nabble.com) (216.139.236.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Dec 2008 03:30:36 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1LCQdl-0000JX-Bu for gcc-help@gcc.gnu.org; Mon, 15 Dec 2008 19:30:33 -0800 Message-ID: <21026658.post@talk.nabble.com> Date: Tue, 16 Dec 2008 03:31:00 -0000 From: yangch To: gcc-help@gcc.gnu.org Subject: pointer reference comparing with int in gcc 4.1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-12/txt/msg00173.txt.bz2 This file cannot compile with gcc 4.1.2, but with gcc3.4.5 it works well. #include #include typedef char str_t[10]; void f(str_t const &s) { printf("sizeof s:%d\n",sizeof(s)); if(s) printf("%s\n",s); } int main() { str_t s1; strcpy(s1,"abc"); f(s1); printf("bytes of int:%d\n\n", sizeof(int)); return 0; } The command: g++ test.cc The output: test.cc: In function 'void f(const char (&)[10])': test.cc:9: error: invalid operands of types 'const char (&)[10]' and 'int' to binary 'operator!=' I didn't find any hint in gcc change notes about this.Is there any way to handle this without changing my source code? -- View this message in context: http://www.nabble.com/pointer-reference-comparing-with-int-in-gcc-4.1.2-tp21026658p21026658.html Sent from the gcc - Help mailing list archive at Nabble.com.