From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25037 invoked by alias); 5 Dec 2002 13:54:17 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24945 invoked by uid 61); 5 Dec 2002 13:54:16 -0000 Date: Thu, 05 Dec 2002 05:54:00 -0000 Message-ID: <20021205135416.24944.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, rmathew@hotmail.com From: ehrhardt@mathematik.uni-ulm.de Reply-To: ehrhardt@mathematik.uni-ulm.de, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, rmathew@hotmail.com, gcc-gnats@gcc.gnu.org Subject: Re: c++/8656: Unable to assign function with __attribute__ and pointer return type to an appropriate variable X-SW-Source: 2002-12/txt/msg00274.txt.bz2 List-Id: Synopsis: Unable to assign function with __attribute__ and pointer return type to an appropriate variable State-Changed-From-To: open->analyzed State-Changed-By: cae State-Changed-When: Thu Dec 5 05:54:11 2002 State-Changed-Why: I'm not sure if this is a bug or nor. The problem is that the types actually differ because the attribute applies to different parts of the declaration. In int * __attribute__((stdcall)) F (void) {}; the attribute is applied to the return type not to the function type. In the extern declaration extern int * (__attribute__((stdcall)) * f) (void); the attribute is applied to the function type. I'm not 100% sure if this is intended or a parser error but I suspect it is intended. As a result of this the error itself is justified because calling conventions for the function and the function pointer differ. The text of the error however isn't helful at all. Workaround: Put explicit parenthesis around the attribute and the function name: int * (__attribute__(stdcall)) F) (void) {}; regards Christian http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8656