From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14497 invoked by alias); 4 May 2010 16:10:37 -0000 Received: (qmail 14378 invoked by uid 48); 4 May 2010 16:10:16 -0000 Date: Tue, 04 May 2010 16:10:00 -0000 Message-ID: <20100504161016.14377.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/39427] F2003: Procedures with same name as types/type constructors In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg00340.txt.bz2 ------- Comment #6 from burnus at gcc dot gnu dot org 2010-05-04 16:10 ------- Created an attachment (id=20557) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20557&action=view) First draft patch (In reply to comment #5) > (In reply to comment #4) > > What a horrible rule... What do you mean? Allowing "name()" as (generic) constructor (function)? Why not? That matches the natural use. If you mean the constraint in comment 3: That just ensures that one cannot have use a structure constructor and generic function simultaneously. > Intel has promised to support it in its next release. Well, I can also promise that _one_ of the next releases will have it :P At least there are plans to improve OOP and there is also a Summer of Code projects for OOP, cf. http://gcc.gnu.org/wiki/SummerOfCode * * * Attached is a draft patch which should work in simple cases. TODO: * Call structure constructor if no generic function matches; that means: Converting the actual arguments into a constructor and do the checking (cf. FIXME in resolve.c) * Add a is-function check: "A generic name may be the same as a derived-type name, in which case all of the procedures in the interface block shall be functions." (Note: That's not a constraint thus one does not need to catch all cases.) * Fix the case of first defining the generic name and then the type: interface t procedure t2 end interface t type t end type t * Add a new "%X" (X = some letter) to finally solve the "@" printing problem in error messages for PPC and for constructors (this PR): gfc_error should then simply strip the @... from the message for arguments to %X while for %s no extra stripping is done as it is currently done. One then only needs to change all relevant %s to %X and one is done. (using a more-intuitive different latter than %X would be helpful; maybe %S = Symbol String?.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39427